ffi 1.0.0 → 1.17.1
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +4 -0
- data/CHANGELOG.md +465 -0
- data/COPYING +49 -0
- data/Gemfile +21 -0
- data/LICENSE +21 -11
- data/LICENSE.SPECS +22 -0
- data/README.md +137 -0
- data/Rakefile +165 -148
- data/ext/ffi_c/AbstractMemory.c +716 -97
- data/ext/ffi_c/AbstractMemory.h +38 -17
- data/ext/ffi_c/ArrayType.c +102 -33
- data/ext/ffi_c/ArrayType.h +20 -18
- data/ext/ffi_c/Buffer.c +229 -54
- data/ext/ffi_c/Call.c +211 -100
- data/ext/ffi_c/Call.h +46 -28
- data/ext/ffi_c/ClosurePool.c +110 -81
- data/ext/ffi_c/ClosurePool.h +31 -1
- data/ext/ffi_c/DynamicLibrary.c +216 -54
- data/ext/ffi_c/DynamicLibrary.h +76 -0
- data/ext/ffi_c/Function.c +527 -164
- data/ext/ffi_c/Function.h +24 -20
- data/ext/ffi_c/FunctionInfo.c +151 -50
- data/ext/ffi_c/LastError.c +112 -28
- data/ext/ffi_c/LastError.h +29 -0
- data/ext/ffi_c/LongDouble.c +65 -0
- data/ext/ffi_c/LongDouble.h +47 -0
- data/ext/ffi_c/MappedType.c +107 -42
- data/ext/ffi_c/MappedType.h +20 -20
- data/ext/ffi_c/MemoryPointer.c +108 -46
- data/ext/ffi_c/MemoryPointer.h +33 -4
- data/ext/ffi_c/MethodHandle.c +71 -67
- data/ext/ffi_c/MethodHandle.h +26 -23
- data/ext/ffi_c/Platform.c +42 -25
- data/ext/ffi_c/Platform.h +32 -3
- data/ext/ffi_c/Pointer.c +324 -51
- data/ext/ffi_c/Pointer.h +29 -18
- data/ext/ffi_c/Struct.c +434 -161
- data/ext/ffi_c/Struct.h +47 -27
- data/ext/ffi_c/StructByValue.c +74 -37
- data/ext/ffi_c/StructByValue.h +20 -18
- data/ext/ffi_c/StructLayout.c +358 -87
- data/ext/ffi_c/Thread.c +129 -0
- data/ext/ffi_c/Thread.h +76 -0
- data/ext/ffi_c/Type.c +241 -76
- data/ext/ffi_c/Type.h +27 -11
- data/ext/ffi_c/Types.c +54 -34
- data/ext/ffi_c/Types.h +24 -24
- data/ext/ffi_c/Variadic.c +151 -55
- data/ext/ffi_c/compat.h +48 -38
- data/ext/ffi_c/extconf.rb +106 -34
- data/ext/ffi_c/ffi.c +35 -26
- data/ext/ffi_c/libffi/.allow-ai-service +0 -0
- data/ext/ffi_c/libffi/.appveyor/site.exp +16 -0
- data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +7 -0
- data/ext/ffi_c/libffi/.appveyor.yml +84 -0
- data/ext/ffi_c/libffi/.ci/ar-lib +270 -0
- data/ext/ffi_c/libffi/.ci/bfin-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
- data/ext/ffi_c/libffi/.ci/build-in-container.sh +10 -0
- data/ext/ffi_c/libffi/.ci/build.sh +124 -0
- data/ext/ffi_c/libffi/.ci/compile +351 -0
- data/ext/ffi_c/libffi/.ci/install.sh +78 -0
- data/ext/ffi_c/libffi/.ci/m32r-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/moxie-sim.exp +60 -0
- data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
- data/ext/ffi_c/libffi/.ci/or1k-sim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +58 -0
- data/ext/ffi_c/libffi/.ci/site.exp +29 -0
- data/ext/ffi_c/libffi/.ci/wine-sim.exp +55 -0
- data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
- data/ext/ffi_c/libffi/.gitattributes +4 -0
- data/ext/ffi_c/libffi/.github/issue_template.md +10 -0
- data/ext/ffi_c/libffi/.github/workflows/build.yml +479 -0
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +172 -0
- data/ext/ffi_c/libffi/.gitignore +46 -0
- data/ext/ffi_c/libffi/{ChangeLog → ChangeLog.old} +6528 -3180
- data/ext/ffi_c/libffi/LICENSE +3 -3
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +353 -0
- data/ext/ffi_c/libffi/Makefile.am +132 -162
- data/ext/ffi_c/libffi/Makefile.in +1339 -1003
- data/ext/ffi_c/libffi/README.md +531 -0
- data/ext/ffi_c/libffi/acinclude.m4 +289 -4
- data/ext/ffi_c/libffi/autogen.sh +2 -0
- data/ext/ffi_c/libffi/compile +227 -21
- data/ext/ffi_c/libffi/config.guess +1034 -778
- data/ext/ffi_c/libffi/config.sub +1394 -1204
- data/ext/ffi_c/libffi/configure +14327 -8503
- data/ext/ffi_c/libffi/configure.ac +294 -247
- data/ext/ffi_c/libffi/configure.host +330 -4
- data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
- data/ext/ffi_c/libffi/doc/Makefile.in +818 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +572 -67
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +53 -46
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +312 -0
- data/ext/ffi_c/libffi/include/Makefile.am +3 -3
- data/ext/ffi_c/libffi/include/Makefile.in +219 -79
- data/ext/ffi_c/libffi/include/ffi.h.in +230 -111
- data/ext/ffi_c/libffi/include/ffi_cfi.h +76 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +78 -16
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +402 -184
- data/ext/ffi_c/libffi/libffi.map.in +81 -0
- data/ext/ffi_c/libffi/libffi.pc.in +3 -2
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +997 -0
- data/ext/ffi_c/libffi/libtool-ldflags +106 -0
- data/ext/ffi_c/libffi/libtool-version +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +5752 -2722
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +13 -0
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +50 -0
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +198 -0
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +158 -0
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +53 -0
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +119 -0
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +49 -0
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +302 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +267 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +89 -0
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +37 -0
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/man/Makefile.am +2 -2
- data/ext/ffi_c/libffi/man/Makefile.in +174 -57
- data/ext/ffi_c/libffi/man/ffi.3 +10 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +6 -4
- data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +73 -0
- data/ext/ffi_c/libffi/missing +155 -300
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +219 -0
- data/ext/ffi_c/libffi/msvcc.sh +353 -0
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +1142 -0
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +97 -0
- data/ext/ffi_c/libffi/src/aarch64/internal.h +100 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +695 -0
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- data/ext/ffi_c/libffi/src/alpha/ffi.c +335 -98
- data/ext/ffi_c/libffi/src/alpha/ffitarget.h +10 -1
- data/ext/ffi_c/libffi/src/alpha/internal.h +23 -0
- data/ext/ffi_c/libffi/src/alpha/osf.S +162 -246
- data/ext/ffi_c/libffi/src/arc/arcompact.S +210 -0
- data/ext/ffi_c/libffi/src/arc/ffi.c +443 -0
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +67 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +806 -194
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +43 -3
- data/ext/ffi_c/libffi/src/arm/internal.h +17 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +381 -231
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/avr32/ffi.c +4 -2
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +8 -3
- data/ext/ffi_c/libffi/src/bfin/ffi.c +196 -0
- data/ext/ffi_c/libffi/src/bfin/ffitarget.h +43 -0
- data/ext/ffi_c/libffi/src/bfin/sysv.S +179 -0
- data/ext/ffi_c/libffi/src/closures.c +574 -100
- data/ext/ffi_c/libffi/src/cris/ffi.c +11 -8
- data/ext/ffi_c/libffi/src/cris/ffitarget.h +8 -3
- data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
- data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
- data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
- data/ext/ffi_c/libffi/src/debug.c +8 -3
- data/ext/ffi_c/libffi/src/dlmalloc.c +89 -17
- data/ext/ffi_c/libffi/src/frv/ffi.c +2 -2
- data/ext/ffi_c/libffi/src/frv/ffitarget.h +8 -7
- data/ext/ffi_c/libffi/src/ia64/ffi.c +48 -12
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +10 -4
- data/ext/ffi_c/libffi/src/ia64/unix.S +28 -3
- data/ext/ffi_c/libffi/src/java_raw_api.c +24 -6
- data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
- data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
- data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
- data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
- data/ext/ffi_c/libffi/src/loongarch64/ffi.c +624 -0
- data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
- data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
- data/ext/ffi_c/libffi/src/m32r/ffi.c +32 -15
- data/ext/ffi_c/libffi/src/m32r/ffitarget.h +8 -3
- data/ext/ffi_c/libffi/src/m68k/ffi.c +97 -13
- data/ext/ffi_c/libffi/src/m68k/ffitarget.h +8 -3
- data/ext/ffi_c/libffi/src/m68k/sysv.S +148 -25
- data/ext/ffi_c/libffi/src/m88k/ffi.c +400 -0
- data/ext/ffi_c/libffi/src/m88k/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/m88k/obsd.S +209 -0
- data/ext/ffi_c/libffi/src/metag/ffi.c +330 -0
- data/ext/ffi_c/libffi/src/metag/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/metag/sysv.S +311 -0
- data/ext/ffi_c/libffi/src/microblaze/ffi.c +321 -0
- data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/microblaze/sysv.S +302 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +392 -104
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +40 -24
- data/ext/ffi_c/libffi/src/mips/n32.S +325 -93
- data/ext/ffi_c/libffi/src/mips/o32.S +211 -31
- data/ext/ffi_c/libffi/src/moxie/eabi.S +101 -0
- data/ext/ffi_c/libffi/src/moxie/ffi.c +310 -0
- data/ext/ffi_c/libffi/src/moxie/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/ffi.c +304 -0
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/sysv.S +136 -0
- data/ext/ffi_c/libffi/src/or1k/ffi.c +341 -0
- data/ext/ffi_c/libffi/src/or1k/ffitarget.h +58 -0
- data/ext/ffi_c/libffi/src/or1k/sysv.S +107 -0
- data/ext/ffi_c/libffi/src/pa/ffi.c +68 -111
- data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +34 -17
- data/ext/ffi_c/libffi/src/pa/hpux32.S +87 -38
- data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +109 -39
- data/ext/ffi_c/libffi/src/powerpc/aix.S +250 -8
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +255 -4
- data/ext/ffi_c/libffi/src/powerpc/asm.h +3 -3
- data/ext/ffi_c/libffi/src/powerpc/darwin.S +211 -78
- data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +356 -102
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +108 -1375
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +746 -210
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1153 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +105 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +923 -0
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +126 -48
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +191 -85
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +438 -108
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +138 -68
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +73 -119
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +141 -32
- data/ext/ffi_c/libffi/src/raw_api.c +18 -5
- data/ext/ffi_c/libffi/src/riscv/ffi.c +514 -0
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +69 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +293 -0
- data/ext/ffi_c/libffi/src/s390/ffi.c +294 -318
- data/ext/ffi_c/libffi/src/s390/ffitarget.h +13 -3
- data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +257 -366
- data/ext/ffi_c/libffi/src/sh/ffi.c +4 -3
- data/ext/ffi_c/libffi/src/sh/ffitarget.h +8 -3
- data/ext/ffi_c/libffi/src/sh64/ffi.c +3 -2
- data/ext/ffi_c/libffi/src/sh64/ffitarget.h +8 -3
- data/ext/ffi_c/libffi/src/sparc/ffi.c +334 -491
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +630 -0
- data/ext/ffi_c/libffi/src/sparc/ffitarget.h +20 -5
- data/ext/ffi_c/libffi/src/sparc/internal.h +26 -0
- data/ext/ffi_c/libffi/src/sparc/v8.S +364 -234
- data/ext/ffi_c/libffi/src/sparc/v9.S +340 -207
- data/ext/ffi_c/libffi/src/tile/ffi.c +355 -0
- data/ext/ffi_c/libffi/src/tile/ffitarget.h +65 -0
- data/ext/ffi_c/libffi/src/tile/tile.S +360 -0
- data/ext/ffi_c/libffi/src/tramp.c +716 -0
- data/ext/ffi_c/libffi/src/types.c +48 -19
- data/ext/ffi_c/libffi/src/vax/elfbsd.S +195 -0
- data/ext/ffi_c/libffi/src/vax/ffi.c +276 -0
- data/ext/ffi_c/libffi/src/vax/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +947 -0
- data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/x86/asmnames.h +30 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +690 -540
- data/ext/ffi_c/libffi/src/x86/ffi64.c +450 -126
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +86 -42
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +361 -0
- data/ext/ffi_c/libffi/src/x86/internal.h +43 -0
- data/ext/ffi_c/libffi/src/x86/internal64.h +36 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +1199 -381
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +998 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +587 -298
- data/ext/ffi_c/libffi/src/x86/win64.S +251 -457
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +238 -0
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +306 -0
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +57 -0
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +268 -0
- data/ext/ffi_c/libffi/stamp-h.in +1 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +80 -73
- data/ext/ffi_c/libffi/testsuite/Makefile.in +251 -117
- data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +86 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
- data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +682 -0
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +22 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +50 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1746 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2885 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +747 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +28 -10
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +108 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +119 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +4 -3
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +88 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +3 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +15 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +4 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +110 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +6 -16
- data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +127 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +6 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +9 -10
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +9 -7
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +7 -7
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +7 -6
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +9 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +9 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +140 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +3 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +21 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +7 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call/closure_stdcall.c → libffi.closures/closure_simple.c} +13 -16
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +22 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +26 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +28 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +33 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +8 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +25 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +40 -8
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +23 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +17 -4
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +113 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +26 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +17 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +33 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +29 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +32 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +28 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +43 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +29 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +18 -4
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +18 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +18 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +24 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +44 -31
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +44 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +22 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +22 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +22 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +23 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +24 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +7 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +21 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +13 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +34 -11
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +55 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +5 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +6 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +9 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +7 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +22 -10
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +125 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +4 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +49 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +8 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +3 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +2 -3
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +57 -56
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +38 -15
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +9 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +19 -6
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +137 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +15 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +15 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +17 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +14 -5
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +17 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +17 -6
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +7 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +7 -7
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +6 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +7 -6
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +8 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.special → libffi.closures}/unwindtest.cc +4 -10
- data/ext/ffi_c/libffi/testsuite/{libffi.special → libffi.closures}/unwindtest_ffi_call.cc +4 -2
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +71 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +80 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +16 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.special/special.exp → libffi.complex/complex.exp} +9 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +51 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +37 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +34 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +19 -0
- data/ext/ffi_c/libffi.bsd.mk +14 -8
- data/ext/ffi_c/libffi.darwin.mk +56 -26
- data/ext/ffi_c/libffi.gnu.mk +9 -6
- data/ext/ffi_c/libffi.mk +13 -8
- data/ext/ffi_c/libffi.vc.mk +26 -0
- data/ext/ffi_c/libffi.vc64.mk +26 -0
- data/ext/ffi_c/rbffi.h +34 -6
- data/ext/ffi_c/{endian.h → rbffi_endian.h} +21 -2
- data/ffi.gemspec +42 -0
- data/lib/ffi/abstract_memory.rb +44 -0
- data/lib/ffi/autopointer.rb +111 -52
- data/lib/ffi/compat.rb +43 -0
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/dynamic_library.rb +118 -0
- data/lib/ffi/enum.rb +203 -22
- data/lib/ffi/errno.rb +27 -12
- data/lib/ffi/ffi.rb +88 -11
- data/lib/ffi/function.rb +71 -0
- data/lib/ffi/io.rb +35 -14
- data/lib/ffi/library.rb +382 -96
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +64 -35
- data/lib/ffi/memorypointer.rb +1 -33
- data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
- data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +181 -0
- data/lib/ffi/platform/aarch64-linux/types.conf +175 -0
- data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
- data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
- data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
- data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/arm-linux/types.conf +132 -0
- data/lib/ffi/platform/hppa1.1-linux/types.conf +178 -0
- data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
- data/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- data/lib/ffi/platform/i386-darwin/types.conf +100 -0
- data/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/i386-gnu/types.conf +107 -0
- data/lib/ffi/platform/i386-linux/types.conf +103 -0
- data/lib/ffi/platform/i386-netbsd/types.conf +126 -0
- data/lib/ffi/platform/i386-openbsd/types.conf +128 -0
- data/lib/ffi/platform/i386-solaris/types.conf +122 -0
- data/lib/ffi/platform/i386-windows/types.conf +52 -0
- data/lib/ffi/platform/ia64-linux/types.conf +104 -0
- data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
- data/lib/ffi/platform/mips-linux/types.conf +102 -0
- data/lib/ffi/platform/mips64-linux/types.conf +104 -0
- data/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsel-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
- data/lib/ffi/platform/powerpc-aix/types.conf +180 -0
- data/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
- data/lib/ffi/platform/powerpc-linux/types.conf +130 -0
- data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
- data/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
- data/lib/ffi/platform/powerpc64le-linux/types.conf +100 -0
- data/lib/ffi/platform/riscv64-linux/types.conf +104 -0
- data/lib/ffi/platform/s390-linux/types.conf +102 -0
- data/lib/ffi/platform/s390x-linux/types.conf +102 -0
- data/lib/ffi/platform/sparc-linux/types.conf +102 -0
- data/lib/ffi/platform/sparc-solaris/types.conf +128 -0
- data/lib/ffi/platform/sparcv9-linux/types.conf +102 -0
- data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
- data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
- data/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +130 -0
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
- data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +132 -0
- data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-openbsd/types.conf +134 -0
- data/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/lib/ffi/platform/x86_64-windows/types.conf +52 -0
- data/lib/ffi/platform.rb +110 -34
- data/lib/ffi/pointer.rb +117 -90
- data/lib/ffi/struct.rb +101 -70
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/struct_layout_builder.rb +90 -21
- data/lib/ffi/tools/const_generator.rb +86 -31
- data/lib/ffi/tools/generator.rb +49 -2
- data/lib/ffi/tools/generator_task.rb +13 -16
- data/lib/ffi/tools/struct_generator.rb +6 -5
- data/lib/ffi/tools/types_generator.rb +25 -11
- data/lib/ffi/types.rb +105 -36
- data/lib/ffi/union.rb +23 -12
- data/lib/ffi/variadic.rb +44 -29
- data/lib/ffi/version.rb +3 -0
- data/lib/ffi.rb +25 -9
- data/rakelib/ffi_gem_helper.rb +65 -0
- data/samples/getlogin.rb +8 -0
- data/samples/getpid.rb +8 -0
- data/samples/gettimeofday.rb +18 -0
- data/samples/hello.rb +8 -0
- data/samples/hello_ractor.rb +11 -0
- data/samples/inotify.rb +60 -0
- data/samples/pty.rb +75 -0
- data/samples/qsort.rb +20 -0
- data/samples/qsort_ractor.rb +28 -0
- data/sig/ffi/abstract_memory.rbs +165 -0
- data/sig/ffi/auto_pointer.rbs +26 -0
- data/sig/ffi/buffer.rbs +18 -0
- data/sig/ffi/data_converter.rbs +10 -0
- data/sig/ffi/dynamic_library.rbs +9 -0
- data/sig/ffi/enum.rbs +38 -0
- data/sig/ffi/function.rbs +39 -0
- data/sig/ffi/library.rbs +42 -0
- data/sig/ffi/native_type.rbs +86 -0
- data/sig/ffi/pointer.rbs +42 -0
- data/sig/ffi/struct.rbs +76 -0
- data/sig/ffi/struct_by_reference.rbs +11 -0
- data/sig/ffi/struct_by_value.rbs +7 -0
- data/sig/ffi/struct_layout.rbs +9 -0
- data/sig/ffi/struct_layout_builder.rbs +5 -0
- data/sig/ffi/type.rbs +39 -0
- data/sig/ffi.rbs +26 -0
- data.tar.gz.sig +0 -0
- metadata +547 -248
- metadata.gz.sig +0 -0
- data/History.txt +0 -109
- data/README.rdoc +0 -70
- data/ext/ffi_c/DataConverter.c +0 -62
- data/ext/ffi_c/StructByReference.c +0 -150
- data/ext/ffi_c/StructByReference.h +0 -50
- data/ext/ffi_c/libffi/ChangeLog.libffi +0 -658
- data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
- data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
- data/ext/ffi_c/libffi/README +0 -306
- data/ext/ffi_c/libffi/aclocal.m4 +0 -8998
- data/ext/ffi_c/libffi/depcomp +0 -584
- data/ext/ffi_c/libffi/doc/libffi.info +0 -533
- data/ext/ffi_c/libffi/doc/stamp-vti +0 -4
- data/ext/ffi_c/libffi/m4/libtool.m4 +0 -7360
- data/ext/ffi_c/libffi/m4/ltoptions.m4 +0 -368
- data/ext/ffi_c/libffi/m4/ltsugar.m4 +0 -123
- data/ext/ffi_c/libffi/m4/ltversion.m4 +0 -23
- data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +0 -92
- data/ext/ffi_c/libffi/mdate-sh +0 -201
- data/ext/ffi_c/libffi/src/x86/darwin.S +0 -444
- data/ext/ffi_c/libffi/src/x86/darwin64.S +0 -416
- data/ext/ffi_c/libffi/src/x86/freebsd.S +0 -458
- data/ext/ffi_c/libffi/src/x86/win32.S +0 -877
- data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +0 -300
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +0 -96
- data/ext/ffi_c/libffi/texinfo.tex +0 -7210
- data/gen/Rakefile +0 -14
- data/spec/ffi/async_callback_spec.rb +0 -23
- data/spec/ffi/bool_spec.rb +0 -24
- data/spec/ffi/buffer_spec.rb +0 -202
- data/spec/ffi/callback_spec.rb +0 -653
- data/spec/ffi/custom_param_type.rb +0 -31
- data/spec/ffi/custom_type_spec.rb +0 -73
- data/spec/ffi/enum_spec.rb +0 -183
- data/spec/ffi/errno_spec.rb +0 -13
- data/spec/ffi/ffi_spec.rb +0 -24
- data/spec/ffi/function_spec.rb +0 -73
- data/spec/ffi/library_spec.rb +0 -174
- data/spec/ffi/managed_struct_spec.rb +0 -56
- data/spec/ffi/number_spec.rb +0 -231
- data/spec/ffi/pointer_spec.rb +0 -210
- data/spec/ffi/rbx/attach_function_spec.rb +0 -28
- data/spec/ffi/rbx/memory_pointer_spec.rb +0 -109
- data/spec/ffi/rbx/spec_helper.rb +0 -1
- data/spec/ffi/rbx/struct_spec.rb +0 -13
- data/spec/ffi/spec_helper.rb +0 -21
- data/spec/ffi/string_spec.rb +0 -103
- data/spec/ffi/strptr_spec.rb +0 -36
- data/spec/ffi/struct_callback_spec.rb +0 -64
- data/spec/ffi/struct_initialize_spec.rb +0 -30
- data/spec/ffi/struct_packed_spec.rb +0 -46
- data/spec/ffi/struct_spec.rb +0 -638
- data/spec/ffi/typedef_spec.rb +0 -62
- data/spec/ffi/union_spec.rb +0 -60
- data/spec/ffi/variadic_spec.rb +0 -84
- data/spec/spec.opts +0 -4
- data/tasks/ann.rake +0 -80
- data/tasks/extension.rake +0 -25
- data/tasks/gem.rake +0 -200
- data/tasks/git.rake +0 -41
- data/tasks/notes.rake +0 -27
- data/tasks/post_load.rake +0 -34
- data/tasks/rdoc.rake +0 -50
- data/tasks/rubyforge.rake +0 -55
- data/tasks/setup.rb +0 -301
- data/tasks/spec.rake +0 -54
- data/tasks/svn.rake +0 -47
- data/tasks/test.rake +0 -40
- /data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
- /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
- /data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
@@ -1,16 +1,18 @@
|
|
1
1
|
/* -----------------------------------------------------------------*-C-*-
|
2
|
-
libffi @VERSION@
|
2
|
+
libffi @VERSION@
|
3
|
+
- Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024 Anthony Green
|
4
|
+
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
|
3
5
|
|
4
|
-
Permission is hereby granted, free of charge, to any person
|
5
|
-
a copy of this software and associated documentation
|
6
|
-
``Software''), to deal in the Software without
|
7
|
-
without limitation the rights to use, copy,
|
8
|
-
distribute, sublicense, and/or sell copies
|
9
|
-
permit persons to whom the Software is
|
10
|
-
the following conditions:
|
6
|
+
Permission is hereby granted, free of charge, to any person
|
7
|
+
obtaining a copy of this software and associated documentation
|
8
|
+
files (the ``Software''), to deal in the Software without
|
9
|
+
restriction, including without limitation the rights to use, copy,
|
10
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies
|
11
|
+
of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
11
13
|
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
in all copies or substantial portions of the Software.
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
14
16
|
|
15
17
|
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
16
18
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
@@ -24,23 +26,14 @@
|
|
24
26
|
----------------------------------------------------------------------- */
|
25
27
|
|
26
28
|
/* -------------------------------------------------------------------
|
27
|
-
|
29
|
+
Most of the API is documented in doc/libffi.texi.
|
28
30
|
|
29
|
-
The raw API is designed to bypass some of the argument packing
|
30
|
-
|
31
|
+
The raw API is designed to bypass some of the argument packing and
|
32
|
+
unpacking on architectures for which it can be avoided. Routines
|
33
|
+
are provided to emulate the raw API if the underlying platform
|
34
|
+
doesn't allow faster implementation.
|
31
35
|
|
32
|
-
|
33
|
-
inside a C function pointer, so that they can be called as C functions,
|
34
|
-
with no understanding on the client side that they are interpreted.
|
35
|
-
It can also be used in other cases in which it is necessary to package
|
36
|
-
up a user specified parameter and a function pointer as a single
|
37
|
-
function pointer.
|
38
|
-
|
39
|
-
The closure API must be implemented in order to get its functionality,
|
40
|
-
e.g. for use by gij. Routines are provided to emulate the raw API
|
41
|
-
if the underlying platform doesn't allow faster implementation.
|
42
|
-
|
43
|
-
More details on the raw and cloure API can be found in:
|
36
|
+
More details on the raw API can be found in:
|
44
37
|
|
45
38
|
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
|
46
39
|
|
@@ -57,15 +50,42 @@ extern "C" {
|
|
57
50
|
#endif
|
58
51
|
|
59
52
|
/* Specify which architecture libffi is configured for. */
|
53
|
+
#ifndef @TARGET@
|
60
54
|
#define @TARGET@
|
55
|
+
#endif
|
61
56
|
|
62
57
|
/* ---- System configuration information --------------------------------- */
|
63
58
|
|
59
|
+
/* If these change, update src/mips/ffitarget.h. */
|
60
|
+
#define FFI_TYPE_VOID 0
|
61
|
+
#define FFI_TYPE_INT 1
|
62
|
+
#define FFI_TYPE_FLOAT 2
|
63
|
+
#define FFI_TYPE_DOUBLE 3
|
64
|
+
#if @HAVE_LONG_DOUBLE@
|
65
|
+
#define FFI_TYPE_LONGDOUBLE 4
|
66
|
+
#else
|
67
|
+
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
|
68
|
+
#endif
|
69
|
+
#define FFI_TYPE_UINT8 5
|
70
|
+
#define FFI_TYPE_SINT8 6
|
71
|
+
#define FFI_TYPE_UINT16 7
|
72
|
+
#define FFI_TYPE_SINT16 8
|
73
|
+
#define FFI_TYPE_UINT32 9
|
74
|
+
#define FFI_TYPE_SINT32 10
|
75
|
+
#define FFI_TYPE_UINT64 11
|
76
|
+
#define FFI_TYPE_SINT64 12
|
77
|
+
#define FFI_TYPE_STRUCT 13
|
78
|
+
#define FFI_TYPE_POINTER 14
|
79
|
+
#define FFI_TYPE_COMPLEX 15
|
80
|
+
|
81
|
+
/* This should always refer to the last type code (for sanity checks). */
|
82
|
+
#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
|
83
|
+
|
64
84
|
#include <ffitarget.h>
|
65
85
|
|
66
86
|
#ifndef LIBFFI_ASM
|
67
87
|
|
68
|
-
#
|
88
|
+
#if defined(_MSC_VER) && !defined(__clang__)
|
69
89
|
#define __attribute__(X)
|
70
90
|
#endif
|
71
91
|
|
@@ -75,20 +95,36 @@ extern "C" {
|
|
75
95
|
/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
|
76
96
|
But we can find it either under the correct ANSI name, or under GNU
|
77
97
|
C's internal name. */
|
98
|
+
|
99
|
+
#define FFI_64_BIT_MAX 9223372036854775807
|
100
|
+
|
78
101
|
#ifdef LONG_LONG_MAX
|
79
102
|
# define FFI_LONG_LONG_MAX LONG_LONG_MAX
|
80
103
|
#else
|
81
104
|
# ifdef LLONG_MAX
|
82
105
|
# define FFI_LONG_LONG_MAX LLONG_MAX
|
106
|
+
# ifdef _AIX52 /* or newer has C99 LLONG_MAX */
|
107
|
+
# undef FFI_64_BIT_MAX
|
108
|
+
# define FFI_64_BIT_MAX 9223372036854775807LL
|
109
|
+
# endif /* _AIX52 or newer */
|
83
110
|
# else
|
84
111
|
# ifdef __GNUC__
|
85
112
|
# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
|
86
113
|
# endif
|
114
|
+
# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */
|
115
|
+
# ifndef __PPC64__
|
116
|
+
# if defined (__IBMC__) || defined (__IBMCPP__)
|
117
|
+
# define FFI_LONG_LONG_MAX LONGLONG_MAX
|
118
|
+
# endif
|
119
|
+
# endif /* __PPC64__ */
|
120
|
+
# undef FFI_64_BIT_MAX
|
121
|
+
# define FFI_64_BIT_MAX 9223372036854775807LL
|
122
|
+
# endif
|
87
123
|
# endif
|
88
124
|
#endif
|
89
125
|
|
90
|
-
/* The closure code assumes that this works on pointers, i.e. a size_t
|
91
|
-
|
126
|
+
/* The closure code assumes that this works on pointers, i.e. a size_t
|
127
|
+
can hold a pointer. */
|
92
128
|
|
93
129
|
typedef struct _ffi_type
|
94
130
|
{
|
@@ -98,6 +134,30 @@ typedef struct _ffi_type
|
|
98
134
|
struct _ffi_type **elements;
|
99
135
|
} ffi_type;
|
100
136
|
|
137
|
+
/* Need minimal decorations for DLLs to work on Windows. GCC has
|
138
|
+
autoimport and autoexport. Always mark externally visible symbols
|
139
|
+
as dllimport for MSVC clients, even if it means an extra indirection
|
140
|
+
when using the static version of the library.
|
141
|
+
Besides, as a workaround, they can define FFI_BUILDING if they
|
142
|
+
*know* they are going to link with the static library. */
|
143
|
+
#if defined _MSC_VER && !defined(FFI_STATIC_BUILD)
|
144
|
+
# if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */
|
145
|
+
# define FFI_API __declspec(dllexport)
|
146
|
+
# else /* Importing libffi.DLL */
|
147
|
+
# define FFI_API __declspec(dllimport)
|
148
|
+
# endif
|
149
|
+
#else
|
150
|
+
# define FFI_API
|
151
|
+
#endif
|
152
|
+
|
153
|
+
/* The externally visible type declarations also need the MSVC DLL
|
154
|
+
decorations, or they will not be exported from the object file. */
|
155
|
+
#if defined LIBFFI_HIDE_BASIC_TYPES
|
156
|
+
# define FFI_EXTERN FFI_API
|
157
|
+
#else
|
158
|
+
# define FFI_EXTERN extern FFI_API
|
159
|
+
#endif
|
160
|
+
|
101
161
|
#ifndef LIBFFI_HIDE_BASIC_TYPES
|
102
162
|
#if SCHAR_MAX == 127
|
103
163
|
# define ffi_type_uchar ffi_type_uint8
|
@@ -130,52 +190,52 @@ typedef struct _ffi_type
|
|
130
190
|
#endif
|
131
191
|
|
132
192
|
#if LONG_MAX == 2147483647
|
133
|
-
# if FFI_LONG_LONG_MAX !=
|
193
|
+
# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX
|
134
194
|
#error "no 64-bit data type supported"
|
135
195
|
# endif
|
136
|
-
#elif LONG_MAX !=
|
196
|
+
#elif LONG_MAX != FFI_64_BIT_MAX
|
137
197
|
#error "long size not supported"
|
138
198
|
#endif
|
139
199
|
|
140
200
|
#if LONG_MAX == 2147483647
|
141
201
|
# define ffi_type_ulong ffi_type_uint32
|
142
202
|
# define ffi_type_slong ffi_type_sint32
|
143
|
-
#elif LONG_MAX ==
|
203
|
+
#elif LONG_MAX == FFI_64_BIT_MAX
|
144
204
|
# define ffi_type_ulong ffi_type_uint64
|
145
205
|
# define ffi_type_slong ffi_type_sint64
|
146
206
|
#else
|
147
207
|
#error "long size not supported"
|
148
208
|
#endif
|
149
209
|
|
150
|
-
/* These are defined in types.c
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
210
|
+
/* These are defined in types.c. */
|
211
|
+
FFI_EXTERN ffi_type ffi_type_void;
|
212
|
+
FFI_EXTERN ffi_type ffi_type_uint8;
|
213
|
+
FFI_EXTERN ffi_type ffi_type_sint8;
|
214
|
+
FFI_EXTERN ffi_type ffi_type_uint16;
|
215
|
+
FFI_EXTERN ffi_type ffi_type_sint16;
|
216
|
+
FFI_EXTERN ffi_type ffi_type_uint32;
|
217
|
+
FFI_EXTERN ffi_type ffi_type_sint32;
|
218
|
+
FFI_EXTERN ffi_type ffi_type_uint64;
|
219
|
+
FFI_EXTERN ffi_type ffi_type_sint64;
|
220
|
+
FFI_EXTERN ffi_type ffi_type_float;
|
221
|
+
FFI_EXTERN ffi_type ffi_type_double;
|
222
|
+
FFI_EXTERN ffi_type ffi_type_pointer;
|
223
|
+
FFI_EXTERN ffi_type ffi_type_longdouble;
|
224
|
+
|
225
|
+
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
|
226
|
+
FFI_EXTERN ffi_type ffi_type_complex_float;
|
227
|
+
FFI_EXTERN ffi_type ffi_type_complex_double;
|
228
|
+
FFI_EXTERN ffi_type ffi_type_complex_longdouble;
|
168
229
|
#endif
|
169
230
|
#endif /* LIBFFI_HIDE_BASIC_TYPES */
|
170
231
|
|
171
232
|
typedef enum {
|
172
233
|
FFI_OK = 0,
|
173
234
|
FFI_BAD_TYPEDEF,
|
174
|
-
FFI_BAD_ABI
|
235
|
+
FFI_BAD_ABI,
|
236
|
+
FFI_BAD_ARGTYPE
|
175
237
|
} ffi_status;
|
176
238
|
|
177
|
-
typedef unsigned FFI_TYPE;
|
178
|
-
|
179
239
|
typedef struct {
|
180
240
|
ffi_abi abi;
|
181
241
|
unsigned nargs;
|
@@ -193,7 +253,7 @@ typedef struct {
|
|
193
253
|
#ifndef FFI_SIZEOF_ARG
|
194
254
|
# if LONG_MAX == 2147483647
|
195
255
|
# define FFI_SIZEOF_ARG 4
|
196
|
-
# elif LONG_MAX ==
|
256
|
+
# elif LONG_MAX == FFI_64_BIT_MAX
|
197
257
|
# define FFI_SIZEOF_ARG 8
|
198
258
|
# endif
|
199
259
|
#endif
|
@@ -225,69 +285,109 @@ typedef ffi_raw ffi_java_raw;
|
|
225
285
|
#endif
|
226
286
|
|
227
287
|
|
288
|
+
FFI_API
|
228
289
|
void ffi_raw_call (ffi_cif *cif,
|
229
290
|
void (*fn)(void),
|
230
291
|
void *rvalue,
|
231
292
|
ffi_raw *avalue);
|
232
293
|
|
233
|
-
void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
|
234
|
-
void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
|
235
|
-
size_t ffi_raw_size (ffi_cif *cif);
|
294
|
+
FFI_API void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
|
295
|
+
FFI_API void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
|
296
|
+
FFI_API size_t ffi_raw_size (ffi_cif *cif);
|
236
297
|
|
237
|
-
/* This is analogous to the raw API, except it uses Java parameter
|
238
|
-
|
239
|
-
|
298
|
+
/* This is analogous to the raw API, except it uses Java parameter
|
299
|
+
packing, even on 64-bit machines. I.e. on 64-bit machines longs
|
300
|
+
and doubles are followed by an empty 64-bit word. */
|
240
301
|
|
302
|
+
#if !FFI_NATIVE_RAW_API
|
303
|
+
FFI_API
|
241
304
|
void ffi_java_raw_call (ffi_cif *cif,
|
242
305
|
void (*fn)(void),
|
243
306
|
void *rvalue,
|
244
|
-
ffi_java_raw *avalue);
|
307
|
+
ffi_java_raw *avalue) __attribute__((deprecated));
|
308
|
+
#endif
|
245
309
|
|
246
|
-
|
247
|
-
void
|
248
|
-
|
310
|
+
FFI_API
|
311
|
+
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
|
312
|
+
FFI_API
|
313
|
+
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) __attribute__((deprecated));
|
314
|
+
FFI_API
|
315
|
+
size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
|
249
316
|
|
250
317
|
/* ---- Definitions for closures ----------------------------------------- */
|
251
318
|
|
252
319
|
#if FFI_CLOSURES
|
253
320
|
|
321
|
+
#ifdef _MSC_VER
|
322
|
+
__declspec(align(8))
|
323
|
+
#endif
|
254
324
|
typedef struct {
|
255
|
-
|
325
|
+
#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
326
|
+
void *trampoline_table;
|
327
|
+
void *trampoline_table_entry;
|
328
|
+
#else
|
329
|
+
union {
|
330
|
+
char tramp[FFI_TRAMPOLINE_SIZE];
|
331
|
+
void *ftramp;
|
332
|
+
};
|
333
|
+
#endif
|
256
334
|
ffi_cif *cif;
|
257
335
|
void (*fun)(ffi_cif*,void*,void**,void*);
|
258
336
|
void *user_data;
|
337
|
+
#if defined(_MSC_VER) && defined(_M_IX86)
|
338
|
+
void *padding;
|
339
|
+
#endif
|
340
|
+
} ffi_closure
|
259
341
|
#ifdef __GNUC__
|
260
|
-
|
261
|
-
#
|
262
|
-
|
342
|
+
__attribute__((aligned (8)))
|
343
|
+
#endif
|
344
|
+
;
|
345
|
+
|
346
|
+
#ifndef __GNUC__
|
347
|
+
# ifdef __sgi
|
348
|
+
# pragma pack 0
|
349
|
+
# endif
|
263
350
|
#endif
|
264
351
|
|
265
|
-
void *ffi_closure_alloc (size_t size, void **code);
|
266
|
-
void ffi_closure_free (void *);
|
352
|
+
FFI_API void *ffi_closure_alloc (size_t size, void **code);
|
353
|
+
FFI_API void ffi_closure_free (void *);
|
267
354
|
|
268
|
-
ffi_status
|
355
|
+
FFI_API ffi_status
|
269
356
|
ffi_prep_closure (ffi_closure*,
|
270
357
|
ffi_cif *,
|
271
358
|
void (*fun)(ffi_cif*,void*,void**,void*),
|
272
|
-
void *user_data)
|
359
|
+
void *user_data)
|
360
|
+
#if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 405)
|
361
|
+
__attribute__((deprecated ("use ffi_prep_closure_loc instead")))
|
362
|
+
#elif defined(__GNUC__) && __GNUC__ >= 3
|
363
|
+
__attribute__((deprecated))
|
364
|
+
#endif
|
365
|
+
;
|
273
366
|
|
274
|
-
ffi_status
|
367
|
+
FFI_API ffi_status
|
275
368
|
ffi_prep_closure_loc (ffi_closure*,
|
276
369
|
ffi_cif *,
|
277
370
|
void (*fun)(ffi_cif*,void*,void**,void*),
|
278
371
|
void *user_data,
|
279
|
-
void*codeloc);
|
372
|
+
void *codeloc);
|
280
373
|
|
374
|
+
#ifdef __sgi
|
375
|
+
# pragma pack 8
|
376
|
+
#endif
|
281
377
|
typedef struct {
|
378
|
+
#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
379
|
+
void *trampoline_table;
|
380
|
+
void *trampoline_table_entry;
|
381
|
+
#else
|
282
382
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
283
|
-
|
383
|
+
#endif
|
284
384
|
ffi_cif *cif;
|
285
385
|
|
286
386
|
#if !FFI_NATIVE_RAW_API
|
287
387
|
|
288
|
-
/*
|
289
|
-
as a regular closure. We use this to install an intermediate
|
290
|
-
handler to do the
|
388
|
+
/* If this is enabled, then a raw closure has the same layout
|
389
|
+
as a regular closure. We use this to install an intermediate
|
390
|
+
handler to do the translation, void** -> ffi_raw*. */
|
291
391
|
|
292
392
|
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
293
393
|
void *this_closure;
|
@@ -300,15 +400,20 @@ typedef struct {
|
|
300
400
|
} ffi_raw_closure;
|
301
401
|
|
302
402
|
typedef struct {
|
403
|
+
#if @FFI_EXEC_TRAMPOLINE_TABLE@
|
404
|
+
void *trampoline_table;
|
405
|
+
void *trampoline_table_entry;
|
406
|
+
#else
|
303
407
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
408
|
+
#endif
|
304
409
|
|
305
410
|
ffi_cif *cif;
|
306
411
|
|
307
412
|
#if !FFI_NATIVE_RAW_API
|
308
413
|
|
309
|
-
/*
|
310
|
-
as a regular closure. We use this to install an intermediate
|
311
|
-
handler to do the
|
414
|
+
/* If this is enabled, then a raw closure has the same layout
|
415
|
+
as a regular closure. We use this to install an intermediate
|
416
|
+
handler to do the translation, void** -> ffi_raw*. */
|
312
417
|
|
313
418
|
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
314
419
|
void *this_closure;
|
@@ -320,78 +425,92 @@ typedef struct {
|
|
320
425
|
|
321
426
|
} ffi_java_raw_closure;
|
322
427
|
|
323
|
-
ffi_status
|
428
|
+
FFI_API ffi_status
|
324
429
|
ffi_prep_raw_closure (ffi_raw_closure*,
|
325
430
|
ffi_cif *cif,
|
326
431
|
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
327
432
|
void *user_data);
|
328
433
|
|
329
|
-
ffi_status
|
434
|
+
FFI_API ffi_status
|
330
435
|
ffi_prep_raw_closure_loc (ffi_raw_closure*,
|
331
436
|
ffi_cif *cif,
|
332
437
|
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
333
438
|
void *user_data,
|
334
439
|
void *codeloc);
|
335
440
|
|
336
|
-
|
441
|
+
#if !FFI_NATIVE_RAW_API
|
442
|
+
FFI_API ffi_status
|
337
443
|
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
|
338
444
|
ffi_cif *cif,
|
339
445
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
340
|
-
void *user_data);
|
446
|
+
void *user_data) __attribute__((deprecated));
|
341
447
|
|
342
|
-
ffi_status
|
448
|
+
FFI_API ffi_status
|
343
449
|
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
|
344
450
|
ffi_cif *cif,
|
345
451
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
346
452
|
void *user_data,
|
347
|
-
void *codeloc);
|
453
|
+
void *codeloc) __attribute__((deprecated));
|
454
|
+
#endif
|
348
455
|
|
349
456
|
#endif /* FFI_CLOSURES */
|
350
457
|
|
458
|
+
#ifdef FFI_GO_CLOSURES
|
459
|
+
|
460
|
+
typedef struct {
|
461
|
+
void *tramp;
|
462
|
+
ffi_cif *cif;
|
463
|
+
void (*fun)(ffi_cif*,void*,void**,void*);
|
464
|
+
} ffi_go_closure;
|
465
|
+
|
466
|
+
FFI_API ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *,
|
467
|
+
void (*fun)(ffi_cif*,void*,void**,void*));
|
468
|
+
|
469
|
+
FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
|
470
|
+
void **avalue, void *closure);
|
471
|
+
|
472
|
+
#endif /* FFI_GO_CLOSURES */
|
473
|
+
|
351
474
|
/* ---- Public interface definition -------------------------------------- */
|
352
475
|
|
476
|
+
FFI_API
|
353
477
|
ffi_status ffi_prep_cif(ffi_cif *cif,
|
354
478
|
ffi_abi abi,
|
355
479
|
unsigned int nargs,
|
356
480
|
ffi_type *rtype,
|
357
481
|
ffi_type **atypes);
|
358
482
|
|
483
|
+
FFI_API
|
484
|
+
ffi_status ffi_prep_cif_var(ffi_cif *cif,
|
485
|
+
ffi_abi abi,
|
486
|
+
unsigned int nfixedargs,
|
487
|
+
unsigned int ntotalargs,
|
488
|
+
ffi_type *rtype,
|
489
|
+
ffi_type **atypes);
|
490
|
+
|
491
|
+
FFI_API
|
359
492
|
void ffi_call(ffi_cif *cif,
|
360
493
|
void (*fn)(void),
|
361
494
|
void *rvalue,
|
362
495
|
void **avalue);
|
363
496
|
|
364
|
-
|
497
|
+
FFI_API
|
498
|
+
ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
|
499
|
+
size_t *offsets);
|
500
|
+
|
501
|
+
/* Convert between closure and function pointers. */
|
502
|
+
#if defined(PA_LINUX) || defined(PA_HPUX)
|
503
|
+
#define FFI_FN(f) ((void (*)(void))((unsigned int)(f) | 2))
|
504
|
+
#define FFI_CL(f) ((void *)((unsigned int)(f) & ~3))
|
505
|
+
#else
|
365
506
|
#define FFI_FN(f) ((void (*)(void))f)
|
507
|
+
#define FFI_CL(f) ((void *)(f))
|
508
|
+
#endif
|
366
509
|
|
367
510
|
/* ---- Definitions shared with assembly code ---------------------------- */
|
368
511
|
|
369
512
|
#endif
|
370
513
|
|
371
|
-
/* If these change, update src/mips/ffitarget.h. */
|
372
|
-
#define FFI_TYPE_VOID 0
|
373
|
-
#define FFI_TYPE_INT 1
|
374
|
-
#define FFI_TYPE_FLOAT 2
|
375
|
-
#define FFI_TYPE_DOUBLE 3
|
376
|
-
#if @HAVE_LONG_DOUBLE@
|
377
|
-
#define FFI_TYPE_LONGDOUBLE 4
|
378
|
-
#else
|
379
|
-
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
|
380
|
-
#endif
|
381
|
-
#define FFI_TYPE_UINT8 5
|
382
|
-
#define FFI_TYPE_SINT8 6
|
383
|
-
#define FFI_TYPE_UINT16 7
|
384
|
-
#define FFI_TYPE_SINT16 8
|
385
|
-
#define FFI_TYPE_UINT32 9
|
386
|
-
#define FFI_TYPE_SINT32 10
|
387
|
-
#define FFI_TYPE_UINT64 11
|
388
|
-
#define FFI_TYPE_SINT64 12
|
389
|
-
#define FFI_TYPE_STRUCT 13
|
390
|
-
#define FFI_TYPE_POINTER 14
|
391
|
-
|
392
|
-
/* This should always refer to the last type code (for sanity checks) */
|
393
|
-
#define FFI_TYPE_LAST FFI_TYPE_POINTER
|
394
|
-
|
395
514
|
#ifdef __cplusplus
|
396
515
|
}
|
397
516
|
#endif
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/* -----------------------------------------------------------------------
|
2
|
+
ffi_cfi.h - Copyright (c) 2014 Red Hat, Inc.
|
3
|
+
|
4
|
+
Conditionally assemble cfi directives. Only necessary for building libffi.
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person
|
7
|
+
obtaining a copy of this software and associated documentation
|
8
|
+
files (the ``Software''), to deal in the Software without
|
9
|
+
restriction, including without limitation the rights to use, copy,
|
10
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies
|
11
|
+
of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
21
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
22
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
24
|
+
DEALINGS IN THE SOFTWARE.
|
25
|
+
|
26
|
+
----------------------------------------------------------------------- */
|
27
|
+
|
28
|
+
#ifndef FFI_CFI_H
|
29
|
+
#define FFI_CFI_H
|
30
|
+
|
31
|
+
#ifdef HAVE_AS_CFI_PSEUDO_OP
|
32
|
+
|
33
|
+
# define cfi_startproc .cfi_startproc
|
34
|
+
# define cfi_endproc .cfi_endproc
|
35
|
+
# define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
|
36
|
+
# define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
|
37
|
+
# define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off
|
38
|
+
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
39
|
+
# define cfi_offset(reg, off) .cfi_offset reg, off
|
40
|
+
# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
|
41
|
+
# define cfi_register(r1, r2) .cfi_register r1, r2
|
42
|
+
# define cfi_return_column(reg) .cfi_return_column reg
|
43
|
+
# define cfi_restore(reg) .cfi_restore reg
|
44
|
+
# define cfi_same_value(reg) .cfi_same_value reg
|
45
|
+
# define cfi_undefined(reg) .cfi_undefined reg
|
46
|
+
# define cfi_remember_state .cfi_remember_state
|
47
|
+
# define cfi_restore_state .cfi_restore_state
|
48
|
+
# define cfi_window_save .cfi_window_save
|
49
|
+
# define cfi_personality(enc, exp) .cfi_personality enc, exp
|
50
|
+
# define cfi_lsda(enc, exp) .cfi_lsda enc, exp
|
51
|
+
# define cfi_escape(...) .cfi_escape __VA_ARGS__
|
52
|
+
|
53
|
+
#else
|
54
|
+
|
55
|
+
# define cfi_startproc
|
56
|
+
# define cfi_endproc
|
57
|
+
# define cfi_def_cfa(reg, off)
|
58
|
+
# define cfi_def_cfa_register(reg)
|
59
|
+
# define cfi_def_cfa_offset(off)
|
60
|
+
# define cfi_adjust_cfa_offset(off)
|
61
|
+
# define cfi_offset(reg, off)
|
62
|
+
# define cfi_rel_offset(reg, off)
|
63
|
+
# define cfi_register(r1, r2)
|
64
|
+
# define cfi_return_column(reg)
|
65
|
+
# define cfi_restore(reg)
|
66
|
+
# define cfi_same_value(reg)
|
67
|
+
# define cfi_undefined(reg)
|
68
|
+
# define cfi_remember_state
|
69
|
+
# define cfi_restore_state
|
70
|
+
# define cfi_window_save
|
71
|
+
# define cfi_personality(enc, exp)
|
72
|
+
# define cfi_lsda(enc, exp)
|
73
|
+
# define cfi_escape(...)
|
74
|
+
|
75
|
+
#endif /* HAVE_AS_CFI_PSEUDO_OP */
|
76
|
+
#endif /* FFI_CFI_H */
|