ffi 1.9.25 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/{appveyor.yml → .appveyor.yml} +7 -2
  3. data/.gitignore +3 -0
  4. data/.gitmodules +1 -0
  5. data/.travis.yml +22 -30
  6. data/CHANGELOG.md +107 -0
  7. data/Gemfile +2 -2
  8. data/README.md +29 -17
  9. data/Rakefile +17 -89
  10. data/ext/ffi_c/AbstractMemory.c +5 -9
  11. data/ext/ffi_c/Call.c +18 -39
  12. data/ext/ffi_c/Call.h +4 -7
  13. data/ext/ffi_c/DynamicLibrary.c +1 -1
  14. data/ext/ffi_c/Function.c +29 -113
  15. data/ext/ffi_c/LastError.c +47 -2
  16. data/ext/ffi_c/LongDouble.c +7 -7
  17. data/ext/ffi_c/Platform.c +0 -47
  18. data/ext/ffi_c/Struct.c +47 -51
  19. data/ext/ffi_c/Struct.h +12 -6
  20. data/ext/ffi_c/StructLayout.c +13 -12
  21. data/ext/ffi_c/Thread.c +6 -222
  22. data/ext/ffi_c/Thread.h +2 -13
  23. data/ext/ffi_c/Type.c +0 -18
  24. data/ext/ffi_c/Type.h +0 -1
  25. data/ext/ffi_c/Types.c +1 -1
  26. data/ext/ffi_c/Variadic.c +9 -15
  27. data/ext/ffi_c/extconf.rb +34 -21
  28. data/ext/ffi_c/ffi.c +3 -8
  29. data/ext/ffi_c/libffi/.appveyor.yml +29 -13
  30. data/ext/ffi_c/libffi/.gitattributes +4 -0
  31. data/ext/ffi_c/libffi/.travis/bfin-sim.exp +58 -0
  32. data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +14 -0
  33. data/ext/ffi_c/libffi/.travis/build-in-container.sh +12 -0
  34. data/ext/ffi_c/libffi/.travis/build.sh +112 -8
  35. data/ext/ffi_c/libffi/.travis/install.sh +65 -16
  36. data/ext/ffi_c/libffi/.travis/m32r-sim.exp +58 -0
  37. data/ext/ffi_c/libffi/.travis/or1k-sim.exp +58 -0
  38. data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +58 -0
  39. data/ext/ffi_c/libffi/.travis/site.exp +10 -1
  40. data/ext/ffi_c/libffi/.travis/wine-sim.exp +55 -0
  41. data/ext/ffi_c/libffi/.travis.yml +47 -2
  42. data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
  43. data/ext/ffi_c/libffi/LICENSE +1 -1
  44. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
  45. data/ext/ffi_c/libffi/Makefile.am +33 -40
  46. data/ext/ffi_c/libffi/Makefile.in +392 -176
  47. data/ext/ffi_c/libffi/README.md +23 -8
  48. data/ext/ffi_c/libffi/configure +319 -343
  49. data/ext/ffi_c/libffi/configure.ac +6 -2
  50. data/ext/ffi_c/libffi/configure.host +26 -9
  51. data/ext/ffi_c/libffi/doc/Makefile.in +9 -5
  52. data/ext/ffi_c/libffi/doc/libffi.texi +26 -14
  53. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  54. data/ext/ffi_c/libffi/fficonfig.h.in +4 -0
  55. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -3
  56. data/ext/ffi_c/libffi/include/Makefile.in +10 -6
  57. data/ext/ffi_c/libffi/include/ffi.h.in +11 -7
  58. data/ext/ffi_c/libffi/include/ffi_common.h +5 -1
  59. data/ext/ffi_c/libffi/install-sh +23 -13
  60. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
  61. data/ext/ffi_c/libffi/ltmain.sh +153 -60
  62. data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
  63. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
  64. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
  65. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +2 -1
  66. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
  67. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
  68. data/ext/ffi_c/libffi/make_sunver.pl +333 -0
  69. data/ext/ffi_c/libffi/man/Makefile.in +9 -5
  70. data/ext/ffi_c/libffi/missing +8 -8
  71. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
  72. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
  73. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
  74. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
  75. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
  76. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +219 -0
  77. data/ext/ffi_c/libffi/msvcc.sh +27 -2
  78. data/ext/ffi_c/libffi/src/aarch64/ffi.c +126 -58
  79. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +13 -2
  80. data/ext/ffi_c/libffi/src/aarch64/sysv.S +8 -6
  81. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
  82. data/ext/ffi_c/libffi/src/arm/ffi.c +40 -5
  83. data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
  84. data/ext/ffi_c/libffi/src/arm/sysv.S +2 -0
  85. data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
  86. data/ext/ffi_c/libffi/src/closures.c +41 -9
  87. data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
  88. data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
  89. data/ext/ffi_c/libffi/src/mips/o32.S +2 -0
  90. data/ext/ffi_c/libffi/src/moxie/ffi.c +1 -1
  91. data/ext/ffi_c/libffi/src/pa/linux.S +23 -2
  92. data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -4
  93. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
  94. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
  95. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
  96. data/ext/ffi_c/libffi/src/powerpc/linux64.S +83 -28
  97. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +68 -4
  98. data/ext/ffi_c/libffi/src/prep_cif.c +4 -2
  99. data/ext/ffi_c/libffi/src/riscv/ffi.c +42 -6
  100. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
  101. data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
  102. data/ext/ffi_c/libffi/src/x86/ffi.c +14 -6
  103. data/ext/ffi_c/libffi/src/x86/ffi64.c +5 -3
  104. data/ext/ffi_c/libffi/src/x86/ffiw64.c +5 -2
  105. data/ext/ffi_c/libffi/src/x86/sysv.S +90 -4
  106. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +995 -0
  107. data/ext/ffi_c/libffi/src/x86/unix64.S +41 -0
  108. data/ext/ffi_c/libffi/src/x86/win64.S +5 -0
  109. data/ext/ffi_c/libffi/testsuite/Makefile.am +114 -109
  110. data/ext/ffi_c/libffi/testsuite/Makefile.in +124 -84
  111. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +26 -22
  112. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
  113. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -1
  114. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +1 -1
  115. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
  116. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
  117. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -1
  118. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
  119. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +138 -0
  120. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +1 -1
  121. data/ext/ffi_c/libffi.darwin.mk +1 -1
  122. data/ext/ffi_c/rbffi.h +0 -2
  123. data/ffi.gemspec +12 -5
  124. data/lib/ffi/data_converter.rb +67 -0
  125. data/lib/ffi/ffi.rb +2 -0
  126. data/lib/ffi/library.rb +6 -6
  127. data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
  128. data/lib/ffi/platform/aarch64-freebsd12/types.conf +128 -0
  129. data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
  130. data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
  131. data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
  132. data/lib/ffi/platform/arm-linux/types.conf +79 -79
  133. data/lib/ffi/platform/i386-cygwin/types.conf +1 -1
  134. data/lib/ffi/platform/i386-darwin/types.conf +63 -63
  135. data/lib/ffi/platform/i386-freebsd/types.conf +89 -89
  136. data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
  137. data/lib/ffi/platform/i386-gnu/types.conf +84 -84
  138. data/lib/ffi/platform/i386-linux/types.conf +77 -77
  139. data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
  140. data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
  141. data/lib/ffi/platform/i386-solaris/types.conf +96 -96
  142. data/lib/ffi/platform/i386-windows/types.conf +84 -84
  143. data/lib/ffi/platform/ia64-linux/types.conf +79 -79
  144. data/lib/ffi/platform/mips-linux/types.conf +79 -79
  145. data/lib/ffi/platform/mips64-linux/types.conf +81 -81
  146. data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
  147. data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
  148. data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
  149. data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
  150. data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
  151. data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
  152. data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
  153. data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
  154. data/lib/ffi/platform/powerpc-linux/types.conf +77 -77
  155. data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
  156. data/lib/ffi/platform/s390-linux/types.conf +79 -79
  157. data/lib/ffi/platform/s390x-linux/types.conf +79 -79
  158. data/lib/ffi/platform/sparc-linux/types.conf +79 -79
  159. data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
  160. data/lib/ffi/platform/sparc64-linux/types.conf +79 -79
  161. data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
  162. data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
  163. data/lib/ffi/platform/x86_64-darwin/types.conf +84 -84
  164. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +148 -0
  165. data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -90
  166. data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
  167. data/lib/ffi/platform/x86_64-linux/types.conf +86 -77
  168. data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
  169. data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
  170. data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
  171. data/lib/ffi/platform/x86_64-windows/types.conf +99 -99
  172. data/lib/ffi/platform.rb +13 -2
  173. data/lib/ffi/pointer.rb +5 -6
  174. data/lib/ffi/struct.rb +5 -66
  175. data/lib/ffi/struct_by_reference.rb +72 -0
  176. data/lib/ffi/struct_layout.rb +96 -0
  177. data/lib/ffi/tools/const_generator.rb +5 -4
  178. data/lib/ffi/tools/generator.rb +47 -2
  179. data/lib/ffi/tools/generator_task.rb +13 -17
  180. data/lib/ffi/tools/struct_generator.rb +4 -4
  181. data/lib/ffi/tools/types_generator.rb +5 -4
  182. data/lib/ffi/types.rb +1 -1
  183. data/lib/ffi/version.rb +1 -1
  184. metadata +144 -115
  185. data/ext/ffi_c/DataConverter.c +0 -91
  186. data/ext/ffi_c/StructByReference.c +0 -190
  187. data/ext/ffi_c/StructByReference.h +0 -50
  188. data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
  189. data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
  190. data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
  191. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +0 -0
  192. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +0 -0
  193. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +0 -0
  194. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +0 -0
  195. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +0 -0
  196. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +0 -0
  197. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +0 -0
  198. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +0 -0
  199. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +0 -0
  200. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +0 -0
  201. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +0 -0
  202. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +0 -0
  203. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +0 -0
  204. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +0 -0
  205. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +0 -0
  206. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +0 -0
  207. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +0 -0
  208. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +0 -0
  209. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +0 -0
  210. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +0 -0
  211. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +0 -0
  212. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +0 -0
  213. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +0 -0
  214. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +0 -0
  215. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +0 -0
  216. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +0 -0
  217. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +0 -0
  218. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +0 -0
  219. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +0 -0
  220. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +0 -0
  221. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +0 -0
  222. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +0 -0
  223. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +0 -0
  224. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +0 -0
  225. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +0 -0
  226. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +0 -0
  227. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +0 -0
  228. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +0 -0
  229. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +0 -0
  230. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +0 -0
  231. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +0 -0
  232. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +0 -0
  233. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +0 -0
  234. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +0 -0
  235. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +0 -0
  236. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +0 -0
  237. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +0 -0
  238. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
  239. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +0 -0
  240. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +0 -0
  241. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +0 -0
  242. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +0 -0
  243. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
  244. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
  245. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +0 -0
  246. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +0 -0
  247. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +0 -0
  248. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +0 -0
  249. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +0 -0
  250. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +0 -0
  251. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +0 -0
  252. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +0 -0
  253. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +0 -0
  254. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +0 -0
  255. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +0 -0
  256. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +0 -0
  257. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +0 -0
  258. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar_va.c +0 -0
  259. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +0 -0
  260. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +0 -0
  261. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +0 -0
  262. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +0 -0
  263. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +0 -0
  264. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort_va.c +0 -0
  265. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
  266. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +0 -0
  267. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +0 -0
  268. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +0 -0
  269. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +0 -0
  270. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +0 -0
  271. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +0 -0
  272. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +0 -0
  273. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +0 -0
  274. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +0 -0
  275. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +0 -0
  276. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +0 -0
  277. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +0 -0
  278. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
  279. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
  280. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
  281. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +0 -0
  282. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +0 -0
  283. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +0 -0
  284. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +0 -0
  285. /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf13d7fccdcd65b73b5286e04fc25a174b7b855ab1803995eaa4564d5d65456a
4
- data.tar.gz: 187c8d21dd770d08e7e123ead2a727fc3e9e384d35ff2b5d37fc3a0df712f37e
3
+ metadata.gz: c60b8c22daf207353adea897b6142f65ea1bbfcac447ee7da373547d7212c19a
4
+ data.tar.gz: 7e3438808bbff423f8cd989e44e2c4288e25bf80d96f04c906617f35eab9846a
5
5
  SHA512:
6
- metadata.gz: 06eb5d5d2c033e0b7ade6d75957f835d7831aca9b492ac752e7d2b4760707ecb07981e1cd366f0059b67c1b2f3a9b5964e70388d123f4997efa0f5c691baede8
7
- data.tar.gz: e050bf8673f3bb19afbe78646f18f452c4fa2d70fc2a8f9f8efb073cd0658f6a7e0f1737dd6a05076422533ecf22e9952f08d407bdd0480bbde31fd55eef52de
6
+ metadata.gz: 439d1b680a2a6d30ebb5957884cc5aad39f708df6fc8616b08ebe5bfa761123bacfe68f3de09773d84f3f521ed40cb0a4844de61a64d5bc9217c7ed3e165f5e9
7
+ data.tar.gz: 866123b57649213c4bef30f5183955fe443a75e7b4cd57e16048559e5326507540182c86a9b149f64431ff06322066bfb70d3e1ca97e7246fa78425e086bf278
@@ -8,15 +8,20 @@ install:
8
8
  }
9
9
  - ridk version
10
10
  - gem --version
11
- - gem install bundler --quiet --no-ri --no-rdoc
11
+ - gem install bundler --quiet --no-document
12
12
  - bundle install
13
13
  build: off
14
14
  build_script:
15
- - bundle exec rake compile || bundle exec rake compile
15
+ - bundle exec rake libffi compile -- %EXTCONFOPTS% || bundle exec rake compile -- %EXTCONFOPTS%
16
16
  test_script:
17
17
  - bundle exec rake test
18
18
  environment:
19
19
  matrix:
20
20
  - RUBYVER: "head-x64"
21
+ EXTCONFOPTS: "--disable-system-libffi"
21
22
  - RUBYVER: 24
23
+ EXTCONFOPTS: "--disable-system-libffi"
22
24
  - RUBYVER: 25-x64
25
+ EXTCONFOPTS: "--enable-system-libffi"
26
+ - RUBYVER: 26
27
+ EXTCONFOPTS: "--enable-system-libffi"
data/.gitignore CHANGED
@@ -20,3 +20,6 @@ vendor
20
20
  Gemfile.lock
21
21
  types_log
22
22
  *.gem
23
+ embed-test.log
24
+ spec/ffi/embed-test/ext/Makefile
25
+ spec/ffi/embed-test/ext/embed_test.bundle
data/.gitmodules CHANGED
@@ -1,3 +1,4 @@
1
1
  [submodule "ext/ffi_c/libffi"]
2
2
  path = ext/ffi_c/libffi
3
3
  url = https://github.com/libffi/libffi.git
4
+ branch = master
data/.travis.yml CHANGED
@@ -1,52 +1,44 @@
1
1
  dist: trusty
2
- sudo: false
3
2
  group: beta
4
3
  language: ruby
5
- before_install:
6
- - gem install bundler
4
+
7
5
  script:
8
6
  - bundle exec rake compile || bundle exec rake compile
9
7
  - bundle exec rake test
8
+ - ITER=10 bundle exec rake bench:all
10
9
  os:
11
10
  - linux
12
11
  - osx
13
12
  rvm:
14
- - 1.9.3
15
- - 2.0.0
16
- - 2.1
17
- - 2.2.8
18
- - 2.3.5
19
- - 2.4.3
20
- - 2.5.0
13
+ - 2.3.8
14
+ - 2.4.5
15
+ - 2.5.3
16
+ - 2.6.0
21
17
  - ruby-head
22
- - rbx
23
- - system
18
+
24
19
  env:
25
20
  - CC=gcc
26
21
  - CC=clang
27
22
  matrix:
28
23
  allow_failures:
29
- - rvm: system
30
- - os: osx
31
- rvm: 2.0.0
32
24
  - os: osx
33
25
  rvm: ruby-head
34
- - rvm: rbx
35
- - rvm: rbx-head
36
- - rvm: 1.9.3
37
- exclude: # ruby 2.4.2 needs build with xcode9 or later on osx
38
26
  - os: osx
39
- rvm: 2.4.2
27
+ rvm: 2.3.8
40
28
  include:
41
- - os: osx
42
- osx_image: xcode9.1
43
- rvm: 2.4.2
44
- env:
45
- - CC=gcc
46
- - os: osx
47
- osx_image: xcode9.1
48
- rvm: 2.4.2
49
- env:
50
- - CC=clang
29
+ - name: powerpc
30
+ language: generic
31
+ before_install: |
32
+ docker run --rm --privileged multiarch/qemu-user-static:register --reset &&
33
+ docker build --rm -t ffi-powerpc -f spec/env/Dockerfile.powerpc .
34
+ script: |
35
+ docker run --rm -t -v `pwd`:/ffi ffi-powerpc
36
+ - name: armhf
37
+ language: generic
38
+ before_install: |
39
+ docker run --rm --privileged multiarch/qemu-user-static:register --reset &&
40
+ docker build --rm -t ffi-armhf -f spec/env/Dockerfile.armhf .
41
+ script: |
42
+ docker run --rm -t -v `pwd`:/ffi ffi-armhf
51
43
  after_failure:
52
44
  - "find build -name mkmf.log | xargs cat"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,106 @@
1
+ 1.12.2 / 2020-02-01
2
+ -------------------
3
+
4
+ * Fix possible segfault at FFI::Struct#[] and []= after GC.compact . #742
5
+
6
+
7
+ 1.12.1 / 2020-01-14
8
+ -------------------
9
+
10
+ Added:
11
+ * Add binary gem support for ruby-2.7 on Windows
12
+
13
+
14
+ 1.12.0 / 2020-01-14
15
+ -------------------
16
+
17
+ Added:
18
+ * FFI::VERSION is defined as part of `require 'ffi'` now.
19
+ It is no longer necessary to `require 'ffi/version'` .
20
+
21
+ Changed:
22
+ * Update libffi to latest master.
23
+
24
+ Deprecated:
25
+ * Overwriting struct layouts is now warned and will be disallowed in ffi-2.0. #734, #735
26
+
27
+
28
+ 1.11.3 / 2019-11-25
29
+ -------------------
30
+
31
+ Removed:
32
+ * Remove support for tainted objects which cause deprecation warnings in ruby-2.7. #730
33
+
34
+
35
+ 1.11.2 / 2019-11-11
36
+ -------------------
37
+
38
+ Added:
39
+ * Add DragonFlyBSD as a platform. #724
40
+
41
+ Changed:
42
+ * Sort all types.conf files, so that files and changes are easier to compare.
43
+ * Regenerated type conf for freebsd12 and x86_64-linux targets. #722
44
+ * Remove MACOSX_DEPLOYMENT_TARGET that was targeting very old version 10.4. #647
45
+ * Fix library name mangling for non glibc Linux/UNIX. #727
46
+ * Fix compiler warnings raised by ruby-2.7
47
+ * Update libffi to latest master.
48
+
49
+
50
+ 1.11.1 / 2019-05-20
51
+ -------------------
52
+
53
+ Changed:
54
+ * Raise required ruby version to >=2.0. #699, #700
55
+ * Fix a possible linker error on ruby < 2.3 on Linux.
56
+
57
+
58
+ 1.11.0 / 2019-05-17
59
+ -------------------
60
+ This version was yanked on 2019-05-20 to fix an install issue on ruby-1.9.3. #700
61
+
62
+ Added:
63
+ * Add ability to disable or force use of system libffi. #669
64
+ Use like `gem inst ffi -- --enable-system-libffi` .
65
+ * Add ability to call FFI callbacks from outside of FFI call frame. #584
66
+ * Add proper documentation to FFI::Generator and ::Task
67
+ * Add gemspec metadata. #696, #698
68
+
69
+ Changed:
70
+ * Fix stdcall on Win32. #649, #669
71
+ * Fix load paths for FFI::Generator::Task
72
+ * Fix FFI::Pointer#read_string(0) to return a binary String. #692
73
+ * Fix benchmark suite so that it runs on ruby-2.x
74
+ * Move FFI::Platform::CPU from C to Ruby. #663
75
+ * Move FFI::StructByReference to Ruby. #681
76
+ * Move FFI::DataConverter to Ruby (#661)
77
+ * Various cleanups and improvements of specs and benchmarks
78
+
79
+ Removed:
80
+ * Remove ruby-1.8 and 1.9 compatibility code. #683
81
+ * Remove unused spec files. #684
82
+
83
+
84
+ 1.10.0 / 2019-01-06
85
+ -------------------
86
+
87
+ Added:
88
+ * Add /opt/local/lib/ to ffi's fallback library search path. #638
89
+ * Add binary gem support for ruby-2.6 on Windows
90
+ * Add FreeBSD on AArch64 and ARM support. #644
91
+ * Add FFI::LastError.winapi_error on Windows native or Cygwin. #633
92
+
93
+ Changed:
94
+ * Update to rake-compiler-dock-0.7.0
95
+ * Use 64-bit inodes on FreeBSD >= 12. #644
96
+ * Switch time_t and suseconds_t types to long on FreeBSD. #627
97
+ * Make register_t long_long on 64-bit FreeBSD. #644
98
+ * Fix Pointer#write_array_of_type #637
99
+
100
+ Removed:
101
+ * Drop binary gem support for ruby-2.0 and 2.1 on Windows
102
+
103
+
1
104
  1.9.25 / 2018-06-03
2
105
  -------------------
3
106
 
@@ -9,6 +112,10 @@ Changed:
9
112
  1.9.24 / 2018-06-02
10
113
  -------------------
11
114
 
115
+ Security Note:
116
+
117
+ This update addresses vulnerability CVE-2018-1000201: DLL loading issue which can be hijacked on Windows OS, when a Symbol is used as DLL name instead of a String. Found by Matthew Bush.
118
+
12
119
  Added:
13
120
  * Added a CHANGELOG file
14
121
  * Add mips64(eb) support, and mips r6 support. (#601)
data/Gemfile CHANGED
@@ -1,9 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  group :development do
4
- gem 'rake', '~> 10.1'
4
+ gem 'rake', '~> 13.0'
5
5
  gem 'rake-compiler', '~> 1.0.3'
6
- gem 'rake-compiler-dock', '~> 0.6.2'
6
+ gem 'rake-compiler-dock', '~> 1.0'
7
7
  gem 'rspec', '~> 3.0'
8
8
  gem 'rubygems-tasks', '~> 0.2.4', :require => 'rubygems/tasks'
9
9
  gem "rubysl", "~> 2.0", :platforms => 'rbx'
data/README.md CHANGED
@@ -1,19 +1,19 @@
1
- # ruby-ffi https://wiki.github.com/ffi/ffi [![Build Status](https://travis-ci.org/ffi/ffi.png?branch=master)](https://travis-ci.org/ffi/ffi) [![Build status Windows](https://ci.appveyor.com/api/projects/status/r8wxn1sd4s794gg1/branch/master?svg=true)](https://ci.appveyor.com/project/larskanis/ffi-aofqa/branch/master)
1
+ # Ruby-FFI https://github.com/ffi/ffi/wiki [![Build Status](https://travis-ci.org/ffi/ffi.svg?branch=master)](https://travis-ci.org/ffi/ffi) [![Build status Windows](https://ci.appveyor.com/api/projects/status/r8wxn1sd4s794gg1/branch/master?svg=true)](https://ci.appveyor.com/project/larskanis/ffi-aofqa/branch/master)
2
2
 
3
3
  ## Description
4
4
 
5
- Ruby-FFI is a ruby extension for programmatically loading dynamic
5
+ Ruby-FFI is a gem for programmatically loading dynamically-linked native
6
6
  libraries, binding functions within them, and calling those functions
7
7
  from Ruby code. Moreover, a Ruby-FFI extension works without changes
8
- on Ruby and JRuby. [Discover why you should write your next extension
9
- using Ruby-FFI](https://wiki.github.com/ffi/ffi/why-use-ffi).
8
+ on CRuby (MRI), JRuby, Rubinius and TruffleRuby. [Discover why you should write your next extension
9
+ using Ruby-FFI](https://github.com/ffi/ffi/wiki/why-use-ffi).
10
10
 
11
- ## Features/problems
11
+ ## Features
12
12
 
13
13
  * Intuitive DSL
14
14
  * Supports all C native types
15
15
  * C structs (also nested), enums and global variables
16
- * Callbacks from C to ruby
16
+ * Callbacks from C to Ruby
17
17
  * Automatic garbage collection of native memory
18
18
 
19
19
  ## Synopsis
@@ -30,20 +30,32 @@ end
30
30
  MyLib.puts 'Hello, World using libc!'
31
31
  ```
32
32
 
33
- For less minimalistic and more sane examples you may look at:
33
+ For less minimalistic and more examples you may look at:
34
34
 
35
- * the samples/ folder
36
- * the examples on the [wiki](https://wiki.github.com/ffi/ffi)
37
- * the projects using FFI listed on this page (https://wiki.github.com/ffi/ffi/projects-using-ffi)
35
+ * the `samples/` folder
36
+ * the examples on the [wiki](https://github.com/ffi/ffi/wiki)
37
+ * the projects using FFI listed on the wiki: https://github.com/ffi/ffi/wiki/projects-using-ffi
38
38
 
39
39
  ## Requirements
40
40
 
41
- You need a sane building environment in order to compile the extension.
42
- At a minimum, you will need:
43
- * A C compiler (e.g. Xcode on OSX, gcc on everything else)
44
- * libffi development library - this is commonly in the libffi-dev or libffi-devel
41
+ When installing the gem on CRuby (MRI), you will need:
42
+ * A C compiler (e.g., Xcode on macOS, `gcc` or `clang` on everything else)
43
+ Optionally (speeds up installation):
44
+ * The `libffi` library and development headers - this is commonly in the `libffi-dev` or `libffi-devel` packages
45
45
 
46
- On Linux systems running with [PaX](https://en.wikipedia.org/wiki/PaX) (Gentoo, Alpine, etc.) FFI may trigger `mprotect` errors. You may need to disable [mprotect](https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options#Restrict_mprotect.28.29) for ruby (`paxctl -m [/path/to/ruby]`) for the time being until a solution is found.
46
+ The ffi gem comes with a builtin libffi version, which is used, when the system libffi library is not available or too old.
47
+ Use of the system libffi can be enforced by:
48
+ ```
49
+ gem install ffi -- --enable-system-libffi # to install the gem manually
50
+ bundle config build.ffi --enable-system-libffi # for bundle install
51
+ ```
52
+ or prevented by `--disable-system-libffi`.
53
+
54
+ On Linux systems running with [PaX](https://en.wikipedia.org/wiki/PaX) (Gentoo, Alpine, etc.), FFI may trigger `mprotect` errors. You may need to disable [mprotect](https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options#Restrict_mprotect.28.29) for ruby (`paxctl -m [/path/to/ruby]`) for the time being until a solution is found.
55
+
56
+ On FreeBSD systems pkgconf must be installed for the gem to be able to compile using clang. Install either via packages `pkg install pkgconf` or from ports via `devel/pkgconf`.
57
+
58
+ On JRuby and TruffleRuby, there are no requirements to install the FFI gem, and `require 'ffi'` works even without installing the gem (i.e., the gem is preinstalled on these implementations).
47
59
 
48
60
  ## Installation
49
61
 
@@ -61,8 +73,7 @@ or from the git repository on github:
61
73
  ## License
62
74
 
63
75
  The ffi library is covered by the BSD license, also see the LICENSE file.
64
- The specs are shared with Rubyspec and are licensed by the same license
65
- as Rubyspec, see the LICENSE.SPECS file.
76
+ The specs are covered by the same license as [ruby/spec](https://github.com/ruby/spec), the MIT license.
66
77
 
67
78
  ## Credits
68
79
 
@@ -74,6 +85,7 @@ The following people have submitted code, bug reports, or otherwise contributed
74
85
  * Andreas Niederl <rico32@gmx.net>
75
86
  * Andrew Cholakian <andrew@andrewvc.com>
76
87
  * Antonio Terceiro <terceiro@softwarelivre.org>
88
+ * Benoit Daloze <eregontp@gmail.com>
77
89
  * Brian Candler <B.Candler@pobox.com>
78
90
  * Brian D. Burns <burns180@gmail.com>
79
91
  * Bryan Kearney <bkearney@redhat.com>
data/Rakefile CHANGED
@@ -3,82 +3,16 @@ require 'rbconfig'
3
3
  require 'rake/clean'
4
4
  require File.expand_path("./lib/ffi/version")
5
5
 
6
- USE_RAKE_COMPILER = (RUBY_PLATFORM =~ /java/) ? false : true
7
- if USE_RAKE_COMPILER
8
- require 'rake/extensiontask'
9
- end
10
-
11
6
  require 'date'
12
7
  require 'fileutils'
13
8
  require 'rbconfig'
14
9
  require 'rspec/core/rake_task'
15
10
  require 'rubygems/package_task'
16
11
 
17
- LIBEXT = case RbConfig::CONFIG['host_os'].downcase
18
- when /darwin/
19
- "dylib"
20
- when /mswin|mingw/
21
- "dll"
22
- else
23
- RbConfig::CONFIG['DLEXT']
24
- end
25
-
26
- CPU = case RbConfig::CONFIG['host_cpu'].downcase
27
- when /i[3456]86/
28
- # Darwin always reports i686, even when running in 64bit mode
29
- if RbConfig::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum)
30
- "x86_64"
31
- else
32
- "i386"
33
- end
34
-
35
- when /amd64|x86_64/
36
- "x86_64"
37
-
38
- when /ppc64|powerpc64/
39
- "powerpc64"
40
-
41
- when /ppc|powerpc/
42
- "powerpc"
43
-
44
- when /^arm/
45
- "arm"
46
-
47
- else
48
- RbConfig::CONFIG['host_cpu']
49
- end
50
-
51
- OS = case RbConfig::CONFIG['host_os'].downcase
52
- when /linux/
53
- "linux"
54
- when /darwin/
55
- "darwin"
56
- when /freebsd/
57
- "freebsd"
58
- when /openbsd/
59
- "openbsd"
60
- when /sunos|solaris/
61
- "solaris"
62
- when /mswin|mingw/
63
- "win32"
64
- else
65
- RbConfig::CONFIG['host_os'].downcase
66
- end
67
-
68
- def which(name)
69
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
70
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
71
- exts.each do |ext|
72
- app = File.join(path, name+ext)
73
- return app if File.executable? app
74
- end
75
- end
76
- nil
12
+ def java?
13
+ /java/ === RUBY_PLATFORM
77
14
  end
78
15
 
79
- GMAKE = which('gmake').nil? ? 'make' : 'gmake'
80
-
81
- LIBTEST = "build/libtest.#{LIBEXT}"
82
16
  BUILD_DIR = "build"
83
17
  BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
84
18
 
@@ -86,7 +20,7 @@ def gem_spec
86
20
  @gem_spec ||= Gem::Specification.load('ffi.gemspec')
87
21
  end
88
22
 
89
- TEST_DEPS = [ LIBTEST ]
23
+ TEST_DEPS = []
90
24
  if RUBY_PLATFORM == "java"
91
25
  RSpec::Core::RakeTask.new(:spec) do |config|
92
26
  config.rspec_opts = YAML.load_file 'spec/spec.opts'
@@ -110,30 +44,22 @@ CLEAN.include 'build'
110
44
  CLEAN.include 'conftest.dSYM'
111
45
  CLEAN.include 'spec/ffi/fixtures/libtest.{dylib,so,dll}'
112
46
  CLEAN.include 'spec/ffi/fixtures/*.o'
47
+ CLEAN.include 'spec/ffi/embed-test/ext/*.{o,def}'
48
+ CLEAN.include 'spec/ffi/embed-test/ext/Makefile'
113
49
  CLEAN.include "pkg/ffi-*-{mingw32,java}"
114
50
  CLEAN.include 'lib/1.*'
115
51
  CLEAN.include 'lib/2.*'
116
- CLEAN.include 'bin'
117
52
 
118
53
  task :distclean => :clobber
119
54
 
120
- desc "Build the native test lib"
121
- file "build/libtest.#{LIBEXT}" => FileList['libtest/**/*.[ch]'] do
122
- sh %{#{GMAKE} -f libtest/GNUmakefile CPU=#{CPU} OS=#{OS} }
123
- end
124
-
125
-
126
- desc "Build test helper lib"
127
- task :libtest => "build/libtest.#{LIBEXT}"
128
-
129
55
  desc "Test the extension"
130
56
  task :test => [ :spec ]
131
57
 
132
58
 
133
59
  namespace :bench do
134
60
  ITER = ENV['ITER'] ? ENV['ITER'].to_i : 100000
135
- bench_libs = "-Ilib -I#{BUILD_DIR}" unless RUBY_PLATFORM == "java"
136
- bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench_helper.rb" }
61
+ bench_libs = "-Ilib" unless RUBY_PLATFORM == "java"
62
+ bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench/bench_helper.rb" }
137
63
  bench_files.each do |bench|
138
64
  task File.basename(bench, ".rb")[6..-1] => TEST_DEPS do
139
65
  sh %{#{Gem.ruby} #{bench_libs} #{bench} #{ITER}}
@@ -162,7 +88,6 @@ namespace 'java' do
162
88
  s.summary = gem_spec.summary
163
89
  s.description = gem_spec.description
164
90
  s.files = %w(LICENSE COPYING README.md CHANGELOG.md Rakefile)
165
- s.has_rdoc = false
166
91
  s.license = gem_spec.license
167
92
  s.platform = 'java'
168
93
  end
@@ -176,8 +101,8 @@ end
176
101
 
177
102
  task 'gem:java' => 'java:gem'
178
103
 
179
-
180
- if USE_RAKE_COMPILER
104
+ unless java?
105
+ require 'rake/extensiontask'
181
106
  Rake::ExtensionTask.new('ffi_c', gem_spec) do |ext|
182
107
  ext.name = 'ffi_c' # indicate the name of the extension.
183
108
  # ext.lib_dir = BUILD_DIR # put binaries into this folder.
@@ -199,12 +124,13 @@ if USE_RAKE_COMPILER
199
124
  sh "x86_64-w64-mingw32-strip -S build/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
200
125
  end
201
126
  end
127
+ end
202
128
 
203
- desc "build a windows gem without all the ceremony."
204
- task "gem:windows" do
205
- require "rake_compiler_dock"
206
- RakeCompilerDock.sh "sudo apt-get update && sudo apt-get install -y libltdl-dev && bundle && rake cross native gem MAKE='nice make -j`nproc`'"
207
- end
129
+ desc "build a windows gem without all the ceremony"
130
+ task "gem:windows" do
131
+ require "rake_compiler_dock"
132
+ sh "bundle package"
133
+ RakeCompilerDock.sh "sudo apt-get update && sudo apt-get install -y libltdl-dev && bundle --local && rake cross native gem MAKE='nice make -j`nproc`'"
208
134
  end
209
135
 
210
136
  directory "ext/ffi_c/libffi"
@@ -212,6 +138,7 @@ file "ext/ffi_c/libffi/autogen.sh" => "ext/ffi_c/libffi" do
212
138
  warn "Downloading libffi ..."
213
139
  sh "git submodule update --init --recursive"
214
140
  end
141
+ task :libffi => "ext/ffi_c/libffi/autogen.sh"
215
142
 
216
143
  LIBFFI_GIT_FILES = `git --git-dir ext/ffi_c/libffi/.git ls-files -z`.split("\x0")
217
144
 
@@ -249,6 +176,7 @@ file types_conf => File.join("lib", "ffi", "version.rb") do |task|
249
176
  end
250
177
  end
251
178
 
179
+ desc "Create or update type information for platform #{FFI::Platform::NAME}"
252
180
  task :types_conf => types_conf do
253
181
  end
254
182
 
@@ -417,7 +417,7 @@ memory_get_string(int argc, VALUE* argv, VALUE self)
417
417
  checkBounds(ptr, off, len);
418
418
 
419
419
  end = memchr(ptr->address + off, 0, len);
420
- return rb_tainted_str_new((char *) ptr->address + off,
420
+ return rb_str_new((char *) ptr->address + off,
421
421
  (end != NULL ? end - ptr->address - off : len));
422
422
  }
423
423
 
@@ -453,7 +453,7 @@ memory_get_array_of_string(int argc, VALUE* argv, VALUE self)
453
453
 
454
454
  for (i = 0; i < count; ++i) {
455
455
  const char* strptr = *((const char**) (ptr->address + off) + i);
456
- rb_ary_push(retVal, (strptr == NULL ? Qnil : rb_tainted_str_new2(strptr)));
456
+ rb_ary_push(retVal, (strptr == NULL ? Qnil : rb_str_new2(strptr)));
457
457
  }
458
458
 
459
459
  } else {
@@ -463,7 +463,7 @@ memory_get_array_of_string(int argc, VALUE* argv, VALUE self)
463
463
  if (strptr == NULL) {
464
464
  break;
465
465
  }
466
- rb_ary_push(retVal, rb_tainted_str_new2(strptr));
466
+ rb_ary_push(retVal, rb_str_new2(strptr));
467
467
  }
468
468
  }
469
469
 
@@ -542,7 +542,7 @@ memory_get_bytes(VALUE self, VALUE offset, VALUE length)
542
542
  checkRead(ptr);
543
543
  checkBounds(ptr, off, len);
544
544
 
545
- return rb_tainted_str_new((char *) ptr->address + off, len);
545
+ return rb_str_new((char *) ptr->address + off, len);
546
546
  }
547
547
 
548
548
  /*
@@ -583,10 +583,6 @@ memory_put_bytes(int argc, VALUE* argv, VALUE self)
583
583
  checkWrite(ptr);
584
584
  checkBounds(ptr, off, len);
585
585
 
586
- if (rb_safe_level() >= 1 && OBJ_TAINTED(str)) {
587
- rb_raise(rb_eSecurityError, "Writing unsafe string to memory");
588
- return Qnil;
589
- }
590
586
  memcpy(ptr->address + off, RSTRING_PTR(str) + idx, len);
591
587
 
592
588
  return self;
@@ -718,7 +714,7 @@ memory_op_get_strptr(AbstractMemory* ptr, long offset)
718
714
  memcpy(&tmp, ptr->address + offset, sizeof(tmp));
719
715
  }
720
716
 
721
- return tmp != NULL ? rb_tainted_str_new2(tmp) : Qnil;
717
+ return tmp != NULL ? rb_str_new2(tmp) : Qnil;
722
718
  }
723
719
 
724
720
  static void