ffi 1.9.24 → 1.16.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +348 -0
- data/Gemfile +4 -5
- data/README.md +44 -17
- data/Rakefile +74 -148
- data/ext/ffi_c/AbstractMemory.c +89 -70
- data/ext/ffi_c/AbstractMemory.h +3 -2
- data/ext/ffi_c/ArrayType.c +49 -13
- data/ext/ffi_c/ArrayType.h +1 -0
- data/ext/ffi_c/Buffer.c +90 -38
- data/ext/ffi_c/Call.c +55 -56
- data/ext/ffi_c/Call.h +12 -6
- data/ext/ffi_c/ClosurePool.c +333 -0
- data/ext/ffi_c/{Closure.h → ClosurePool.h} +25 -13
- data/ext/ffi_c/DynamicLibrary.c +91 -33
- data/ext/ffi_c/Function.c +306 -235
- data/ext/ffi_c/Function.h +3 -5
- data/ext/ffi_c/FunctionInfo.c +87 -32
- data/ext/ffi_c/LastError.c +74 -15
- data/ext/ffi_c/LongDouble.c +12 -10
- data/ext/ffi_c/LongDouble.h +0 -4
- data/ext/ffi_c/MappedType.c +66 -23
- data/ext/ffi_c/MappedType.h +0 -2
- data/ext/ffi_c/MemoryPointer.c +37 -15
- data/ext/ffi_c/MemoryPointer.h +0 -4
- data/ext/ffi_c/MethodHandle.c +265 -38
- data/ext/ffi_c/MethodHandle.h +3 -2
- data/ext/ffi_c/Platform.c +5 -56
- data/ext/ffi_c/Pointer.c +93 -55
- data/ext/ffi_c/Pointer.h +1 -4
- data/ext/ffi_c/Struct.c +202 -134
- data/ext/ffi_c/Struct.h +18 -9
- data/ext/ffi_c/StructByValue.c +50 -23
- data/ext/ffi_c/StructLayout.c +135 -64
- data/ext/ffi_c/Thread.c +4 -228
- data/ext/ffi_c/Thread.h +1 -20
- data/ext/ffi_c/Type.c +105 -55
- data/ext/ffi_c/Type.h +3 -2
- data/ext/ffi_c/Types.c +8 -9
- data/ext/ffi_c/Types.h +3 -4
- data/ext/ffi_c/Variadic.c +88 -47
- data/ext/ffi_c/compat.h +26 -22
- data/ext/ffi_c/extconf.rb +75 -32
- data/ext/ffi_c/ffi.c +9 -10
- 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 +53 -19
- 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/install.sh +78 -0
- data/ext/ffi_c/libffi/.ci/m32r-sim.exp +58 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +1 -1
- 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/workflows/build.yml +460 -0
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +171 -0
- data/ext/ffi_c/libffi/.gitignore +10 -2
- data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
- data/ext/ffi_c/libffi/Makefile.am +64 -73
- data/ext/ffi_c/libffi/Makefile.in +553 -235
- data/ext/ffi_c/libffi/README.md +165 -100
- data/ext/ffi_c/libffi/acinclude.m4 +10 -112
- data/ext/ffi_c/libffi/compile +348 -0
- data/ext/ffi_c/libffi/config.guess +950 -662
- data/ext/ffi_c/libffi/config.sub +1362 -1306
- data/ext/ffi_c/libffi/configure +4909 -4096
- data/ext/ffi_c/libffi/configure.ac +93 -32
- data/ext/ffi_c/libffi/configure.host +76 -28
- data/ext/ffi_c/libffi/doc/Makefile.in +15 -8
- data/ext/ffi_c/libffi/doc/libffi.texi +107 -46
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +22 -44
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +165 -56
- data/ext/ffi_c/libffi/include/Makefile.am +1 -1
- data/ext/ffi_c/libffi/include/Makefile.in +17 -12
- data/ext/ffi_c/libffi/include/ffi.h.in +64 -48
- data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +34 -1
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +107 -74
- data/ext/ffi_c/libffi/libffi.map.in +8 -12
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
- data/ext/ffi_c/libffi/libtool-version +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +576 -284
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +18 -14
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +108 -72
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -44
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/make_sunver.pl +333 -0
- data/ext/ffi_c/libffi/man/Makefile.in +15 -8
- data/ext/ffi_c/libffi/missing +8 -8
- 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 +39 -14
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +286 -98
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +19 -3
- data/ext/ffi_c/libffi/src/aarch64/internal.h +33 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +142 -37
- data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
- data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
- data/ext/ffi_c/libffi/src/arc/ffi.c +325 -148
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +112 -10
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +117 -44
- data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
- data/ext/ffi_c/libffi/src/closures.c +189 -48
- 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/dlmalloc.c +6 -1
- data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/ia64/ffi.c +12 -0
- data/ext/ffi_c/libffi/src/ia64/unix.S +20 -2
- 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 +621 -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 +31 -14
- data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/mips/ffi.c +245 -66
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +8 -1
- data/ext/ffi_c/libffi/src/mips/n32.S +137 -28
- data/ext/ffi_c/libffi/src/mips/o32.S +63 -4
- data/ext/ffi_c/libffi/src/moxie/ffi.c +48 -23
- data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
- data/ext/ffi_c/libffi/src/pa/ffi.c +62 -108
- data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +20 -11
- 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/ffi.c +6 -4
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +93 -28
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +83 -5
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +26 -4
- data/ext/ffi_c/libffi/src/riscv/ffi.c +79 -10
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +16 -0
- data/ext/ffi_c/libffi/src/tramp.c +716 -0
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +934 -0
- data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +128 -49
- data/ext/ffi_c/libffi/src/x86/ffi64.c +89 -23
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +21 -4
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +63 -10
- data/ext/ffi_c/libffi/src/x86/internal.h +14 -0
- data/ext/ffi_c/libffi/src/x86/internal64.h +14 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +274 -45
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +998 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +190 -4
- data/ext/ffi_c/libffi/src/x86/win64.S +32 -10
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +16 -8
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +4 -0
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +26 -16
- data/ext/ffi_c/libffi/testsuite/Makefile.am +127 -109
- data/ext/ffi_c/libffi/testsuite/Makefile.in +144 -88
- 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 +80 -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 +71 -25
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +5 -4
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +5 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +3 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
- 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 +8 -9
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +1 -1
- 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/va_1.c +1 -119
- 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 +13 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +11 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +15 -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 → libffi.closures}/closure_simple.c +6 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +18 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +29 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +21 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +35 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +19 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +18 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +22 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +13 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +29 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +24 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +28 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +24 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +39 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +25 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +14 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +14 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +14 -2
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +20 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +40 -25
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +40 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +18 -3
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +18 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +19 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +3 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +9 -1
- 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 +11 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +22 -3
- 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 +5 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +10 -0
- 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.call → libffi.closures}/cls_struct_va1.c +11 -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.call → libffi.closures}/cls_uint_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +4 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +2 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +3 -0
- 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 +24 -22
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +32 -9
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +12 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +21 -5
- 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 +10 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +10 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +11 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +9 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +11 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +11 -0
- 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_medium.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +1 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +6 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +2 -1
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +1 -0
- data/ext/ffi_c/libffi.bsd.mk +2 -2
- data/ext/ffi_c/libffi.darwin.mk +1 -1
- data/ext/ffi_c/libffi.gnu.mk +2 -2
- data/ext/ffi_c/rbffi.h +1 -3
- data/ffi.gemspec +15 -9
- data/lib/ffi/abstract_memory.rb +44 -0
- data/lib/ffi/autopointer.rb +8 -23
- data/lib/ffi/compat.rb +43 -0
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/dynamic_library.rb +89 -0
- data/lib/ffi/enum.rb +18 -11
- data/lib/ffi/ffi.rb +6 -0
- data/lib/ffi/function.rb +71 -0
- data/lib/ffi/io.rb +3 -3
- data/lib/ffi/library.rb +65 -77
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +3 -3
- 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 +81 -81
- 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 +110 -82
- 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 +1 -1
- data/lib/ffi/platform/i386-darwin/types.conf +63 -63
- data/lib/ffi/platform/i386-freebsd/types.conf +89 -89
- data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/i386-gnu/types.conf +84 -84
- data/lib/ffi/platform/i386-linux/types.conf +77 -77
- data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
- data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
- data/lib/ffi/platform/i386-solaris/types.conf +96 -96
- data/lib/ffi/platform/i386-windows/types.conf +43 -96
- data/lib/ffi/platform/ia64-linux/types.conf +79 -79
- data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
- data/lib/ffi/platform/mips-linux/types.conf +79 -79
- data/lib/ffi/platform/mips64-linux/types.conf +81 -81
- data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
- data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
- data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
- data/lib/ffi/platform/powerpc-linux/types.conf +108 -78
- data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
- data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
- 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 +79 -79
- data/lib/ffi/platform/s390x-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-linux/types.conf +79 -79
- data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
- data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
- data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
- data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
- data/lib/ffi/platform/x86_64-darwin/types.conf +88 -84
- data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -90
- 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 +107 -77
- data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
- data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
- data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
- data/lib/ffi/platform/x86_64-windows/types.conf +42 -110
- data/lib/ffi/platform.rb +43 -20
- data/lib/ffi/pointer.rb +26 -20
- data/lib/ffi/struct.rb +14 -68
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/struct_layout_builder.rb +1 -1
- data/lib/ffi/tools/const_generator.rb +11 -8
- data/lib/ffi/tools/generator.rb +47 -2
- data/lib/ffi/tools/generator_task.rb +13 -17
- data/lib/ffi/tools/struct_generator.rb +6 -5
- data/lib/ffi/tools/types_generator.rb +7 -4
- data/lib/ffi/types.rb +33 -7
- data/lib/ffi/variadic.rb +20 -18
- data/lib/ffi/version.rb +1 -1
- data/lib/ffi.rb +10 -3
- data/rakelib/ffi_gem_helper.rb +65 -0
- data/samples/getlogin.rb +1 -1
- data/samples/getpid.rb +1 -1
- data/samples/gettimeofday.rb +8 -8
- data/samples/hello.rb +2 -1
- data/samples/hello_ractor.rb +11 -0
- data/samples/inotify.rb +1 -1
- data/samples/pty.rb +1 -2
- data/samples/qsort.rb +0 -1
- data/samples/qsort_ractor.rb +28 -0
- data.tar.gz.sig +0 -0
- metadata +252 -153
- metadata.gz.sig +0 -0
- data/.gitignore +0 -22
- data/.gitmodules +0 -3
- data/.travis.yml +0 -52
- data/.yardopts +0 -5
- data/appveyor.yml +0 -22
- data/ext/ffi_c/Closure.c +0 -54
- data/ext/ffi_c/DataConverter.c +0 -91
- data/ext/ffi_c/StructByReference.c +0 -190
- data/ext/ffi_c/StructByReference.h +0 -50
- data/ext/ffi_c/libffi/.travis/build.sh +0 -34
- data/ext/ffi_c/libffi/.travis/install.sh +0 -22
- data/ext/ffi_c/libffi/.travis/site.exp +0 -18
- data/ext/ffi_c/libffi/.travis.yml +0 -34
- data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
- data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
- data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar_va.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +0 -44
- data/ext/ffi_c/win32/stdbool.h +0 -8
- data/ext/ffi_c/win32/stdint.h +0 -201
- data/samples/sample_helper.rb +0 -6
- data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
- data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
- 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}/cls_many_mixed_args.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
- data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
- data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +79 -79
@@ -1,7 +1,8 @@
|
|
1
1
|
\input texinfo @c -*-texinfo-*-
|
2
2
|
@c %**start of header
|
3
3
|
@setfilename libffi.info
|
4
|
-
@
|
4
|
+
@include version.texi
|
5
|
+
@settitle libffi: the portable foreign function interface library
|
5
6
|
@setchapternewpage off
|
6
7
|
@c %**end of header
|
7
8
|
|
@@ -12,32 +13,43 @@
|
|
12
13
|
@syncodeindex pg cp
|
13
14
|
@syncodeindex tp cp
|
14
15
|
|
15
|
-
@include version.texi
|
16
|
-
|
17
16
|
@copying
|
18
17
|
|
19
|
-
This manual is for
|
18
|
+
This manual is for libffi, a portable foreign function interface
|
20
19
|
library.
|
21
20
|
|
22
|
-
Copyright @copyright{} 2008,
|
21
|
+
Copyright @copyright{} 2008--2019, 2021, 2022 Anthony Green and Red Hat, Inc.
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
24
|
+
a copy of this software and associated documentation files (the
|
25
|
+
``Software''), to deal in the Software without restriction, including
|
26
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
27
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
28
|
+
permit persons to whom the Software is furnished to do so, subject to
|
29
|
+
the following conditions:
|
30
|
+
|
31
|
+
The above copyright notice and this permission notice shall be
|
32
|
+
included in all copies or substantial portions of the Software.
|
33
|
+
|
34
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
35
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
36
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
37
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
38
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
39
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
40
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
30
41
|
|
31
|
-
@end quotation
|
32
42
|
@end copying
|
33
43
|
|
34
44
|
@dircategory Development
|
35
45
|
@direntry
|
36
|
-
* libffi: (libffi). Portable foreign
|
46
|
+
* libffi: (libffi). Portable foreign function interface library.
|
37
47
|
@end direntry
|
38
48
|
|
39
49
|
@titlepage
|
40
|
-
@title
|
50
|
+
@title libffi: a foreign function interface library
|
51
|
+
@subtitle For Version @value{VERSION} of libffi
|
52
|
+
@author Anthony Green
|
41
53
|
@page
|
42
54
|
@vskip 0pt plus 1filll
|
43
55
|
@insertcopying
|
@@ -53,6 +65,7 @@ section entitled ``GNU General Public License''.
|
|
53
65
|
@menu
|
54
66
|
* Introduction:: What is libffi?
|
55
67
|
* Using libffi:: How to use libffi.
|
68
|
+
* Memory Usage:: Where memory for closures comes from.
|
56
69
|
* Missing Features:: Things libffi can't do.
|
57
70
|
* Index:: Index.
|
58
71
|
@end menu
|
@@ -78,10 +91,10 @@ sometimes called the @dfn{ABI} or @dfn{Application Binary Interface}.
|
|
78
91
|
Some programs may not know at the time of compilation what arguments
|
79
92
|
are to be passed to a function. For instance, an interpreter may be
|
80
93
|
told at run-time about the number and types of arguments used to call
|
81
|
-
a given function. @
|
94
|
+
a given function. @code{libffi} can be used in such programs to
|
82
95
|
provide a bridge from the interpreter program to compiled code.
|
83
96
|
|
84
|
-
The @
|
97
|
+
The @code{libffi} library provides a portable, high level programming
|
85
98
|
interface to various calling conventions. This allows a programmer to
|
86
99
|
call any function specified by a call interface description at run
|
87
100
|
time.
|
@@ -89,9 +102,9 @@ time.
|
|
89
102
|
@acronym{FFI} stands for Foreign Function Interface. A foreign
|
90
103
|
function interface is the popular name for the interface that allows
|
91
104
|
code written in one language to call code written in another language.
|
92
|
-
The @
|
105
|
+
The @code{libffi} library really only provides the lowest, machine
|
93
106
|
dependent layer of a fully featured foreign function interface. A
|
94
|
-
layer must exist above @
|
107
|
+
layer must exist above @code{libffi} that handles type conversions for
|
95
108
|
values passed between the two languages.
|
96
109
|
@cindex FFI
|
97
110
|
@cindex Foreign Function Interface
|
@@ -114,7 +127,7 @@ values passed between the two languages.
|
|
114
127
|
@node The Basics
|
115
128
|
@section The Basics
|
116
129
|
|
117
|
-
@
|
130
|
+
@code{libffi} assumes that you have a pointer to the function you wish
|
118
131
|
to call and that you know the number and types of arguments to pass
|
119
132
|
it, as well as the return type of the function.
|
120
133
|
|
@@ -164,6 +177,11 @@ variadic arguments. It must be greater than zero.
|
|
164
177
|
@var{ntotalargs} the total number of arguments, including variadic
|
165
178
|
and fixed arguments. @var{argtypes} must have this many elements.
|
166
179
|
|
180
|
+
@code{ffi_prep_cif_var} will return @code{FFI_BAD_ARGTYPE} if any of
|
181
|
+
the variable argument types are @code{ffi_type_float} (promote to
|
182
|
+
@code{ffi_type_double} first), or any integer type small than an int
|
183
|
+
(promote to an int-sized type first).
|
184
|
+
|
167
185
|
Note that, different cif's must be prepped for calls to the same
|
168
186
|
function when different numbers of arguments are passed.
|
169
187
|
|
@@ -195,22 +213,20 @@ to ensure this. If @var{cif} declares that the function returns
|
|
195
213
|
@code{void} (using @code{ffi_type_void}), then @var{rvalue} is
|
196
214
|
ignored.
|
197
215
|
|
198
|
-
In most situations, @
|
216
|
+
In most situations, @code{libffi} will handle promotion according to
|
199
217
|
the ABI. However, for historical reasons, there is a special case
|
200
218
|
with return values that must be handled by your code. In particular,
|
201
219
|
for integral (not @code{struct}) types that are narrower than the
|
202
220
|
system register size, the return value will be widened by
|
203
|
-
@
|
221
|
+
@code{libffi}. @code{libffi} provides a type, @code{ffi_arg}, that
|
204
222
|
can be used as the return type. For example, if the CIF was defined
|
205
|
-
with a return type of @code{char}, @
|
223
|
+
with a return type of @code{char}, @code{libffi} will try to store a
|
206
224
|
full @code{ffi_arg} into the return value.
|
207
225
|
|
208
226
|
@var{avalues} is a vector of @code{void *} pointers that point to the
|
209
227
|
memory locations holding the argument values for a call. If @var{cif}
|
210
228
|
declares that the function has no arguments (i.e., @var{nargs} was 0),
|
211
|
-
then @var{avalues} is ignored.
|
212
|
-
modified by the callee (for instance, structs passed by value); the
|
213
|
-
burden of copying pass-by-value arguments is placed on the caller.
|
229
|
+
then @var{avalues} is ignored.
|
214
230
|
|
215
231
|
Note that while the return value must be register-sized, arguments
|
216
232
|
should exactly match their declared type. For example, if an argument
|
@@ -237,26 +253,26 @@ int main()
|
|
237
253
|
void *values[1];
|
238
254
|
char *s;
|
239
255
|
ffi_arg rc;
|
240
|
-
|
241
|
-
/* Initialize the argument info vectors */
|
256
|
+
|
257
|
+
/* Initialize the argument info vectors */
|
242
258
|
args[0] = &ffi_type_pointer;
|
243
259
|
values[0] = &s;
|
244
|
-
|
260
|
+
|
245
261
|
/* Initialize the cif */
|
246
|
-
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
262
|
+
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
247
263
|
&ffi_type_sint, args) == FFI_OK)
|
248
264
|
@{
|
249
265
|
s = "Hello World!";
|
250
266
|
ffi_call(&cif, puts, &rc, values);
|
251
267
|
/* rc now holds the result of the call to puts */
|
252
|
-
|
253
|
-
/* values holds a pointer to the function's arg, so to
|
254
|
-
call puts() again all we need to do is change the
|
268
|
+
|
269
|
+
/* values holds a pointer to the function's arg, so to
|
270
|
+
call puts() again all we need to do is change the
|
255
271
|
value of s */
|
256
272
|
s = "This is cool!";
|
257
273
|
ffi_call(&cif, puts, &rc, values);
|
258
274
|
@}
|
259
|
-
|
275
|
+
|
260
276
|
return 0;
|
261
277
|
@}
|
262
278
|
@end example
|
@@ -394,8 +410,8 @@ when passing to @code{ffi_prep_cif}.
|
|
394
410
|
@node Structures
|
395
411
|
@subsection Structures
|
396
412
|
|
397
|
-
@
|
398
|
-
You must first describe the structure to @
|
413
|
+
@code{libffi} is perfectly happy passing structures back and forth.
|
414
|
+
You must first describe the structure to @code{libffi} by creating a
|
399
415
|
new @code{ffi_type} object for it.
|
400
416
|
|
401
417
|
@tindex ffi_type
|
@@ -415,7 +431,7 @@ For a structure, this should be set to @code{FFI_TYPE_STRUCT}.
|
|
415
431
|
This is a @samp{NULL}-terminated array of pointers to @code{ffi_type}
|
416
432
|
objects. There is one element per field of the struct.
|
417
433
|
|
418
|
-
Note that @
|
434
|
+
Note that @code{libffi} has no special support for bit-fields. You
|
419
435
|
must manage these manually.
|
420
436
|
@end table
|
421
437
|
@end deftp
|
@@ -492,7 +508,7 @@ valid here.
|
|
492
508
|
|
493
509
|
@subsubsection Arrays
|
494
510
|
|
495
|
-
@
|
511
|
+
@code{libffi} does not have direct support for arrays or unions.
|
496
512
|
However, they can be emulated using structures.
|
497
513
|
|
498
514
|
To emulate an array, simply create an @code{ffi_type} using
|
@@ -519,7 +535,7 @@ structure types created like this should only be used to refer to
|
|
519
535
|
members of real @code{FFI_TYPE_STRUCT} objects.
|
520
536
|
|
521
537
|
However, a phony array type like this will not cause any errors from
|
522
|
-
@
|
538
|
+
@code{libffi} if you use it as an argument or return type. This may
|
523
539
|
be confusing.
|
524
540
|
|
525
541
|
@subsubsection Unions
|
@@ -612,7 +628,7 @@ Here is the corresponding code to describe this struct to
|
|
612
628
|
tm_type.size = tm_type.alignment = 0;
|
613
629
|
tm_type.type = FFI_TYPE_STRUCT;
|
614
630
|
tm_type.elements = &tm_type_elements;
|
615
|
-
|
631
|
+
|
616
632
|
for (i = 0; i < 9; i++)
|
617
633
|
tm_type_elements[i] = &ffi_type_sint;
|
618
634
|
|
@@ -628,7 +644,7 @@ Here is the corresponding code to describe this struct to
|
|
628
644
|
@node Complex
|
629
645
|
@subsection Complex Types
|
630
646
|
|
631
|
-
@
|
647
|
+
@code{libffi} supports the complex types defined by the C99
|
632
648
|
standard (@code{_Complex float}, @code{_Complex double} and
|
633
649
|
@code{_Complex long double} with the built-in type descriptors
|
634
650
|
@code{ffi_type_complex_float}, @code{ffi_type_complex_double} and
|
@@ -636,7 +652,7 @@ standard (@code{_Complex float}, @code{_Complex double} and
|
|
636
652
|
|
637
653
|
Custom complex types like @code{_Complex int} can also be used.
|
638
654
|
An @code{ffi_type} object has to be defined to describe the
|
639
|
-
complex type to @
|
655
|
+
complex type to @code{libffi}.
|
640
656
|
|
641
657
|
@tindex ffi_type
|
642
658
|
@deftp {Data type} ffi_type
|
@@ -803,7 +819,6 @@ Free memory allocated using @code{ffi_closure_alloc}. The argument is
|
|
803
819
|
the writable address that was returned.
|
804
820
|
@end defun
|
805
821
|
|
806
|
-
|
807
822
|
Once you have allocated the memory for a closure, you must construct a
|
808
823
|
@code{ffi_cif} describing the function call. Finally you can prepare
|
809
824
|
the closure function:
|
@@ -875,7 +890,7 @@ writable and executable addresses.
|
|
875
890
|
@node Closure Example
|
876
891
|
@section Closure Example
|
877
892
|
|
878
|
-
A trivial example that creates a new @code{puts} by binding
|
893
|
+
A trivial example that creates a new @code{puts} by binding
|
879
894
|
@code{fputs} with @code{stdout}.
|
880
895
|
|
881
896
|
@example
|
@@ -953,6 +968,55 @@ Currently the only affected platform is PowerPC and the only affected
|
|
953
968
|
type is @code{long double}.
|
954
969
|
@end itemize
|
955
970
|
|
971
|
+
@node Memory Usage
|
972
|
+
@chapter Memory Usage
|
973
|
+
|
974
|
+
Note that memory allocated by @code{ffi_closure_alloc} and freed by
|
975
|
+
@code{ffi_closure_free} does not come from the same general pool of
|
976
|
+
memory that @code{malloc} and @code{free} use. To accomodate security
|
977
|
+
settings, @code{libffi} may aquire memory, for example, by mapping
|
978
|
+
temporary files into multiple places in the address space (once to
|
979
|
+
write out the closure, a second to execute it). The search follows
|
980
|
+
this list, using the first that works:
|
981
|
+
|
982
|
+
@itemize @bullet
|
983
|
+
|
984
|
+
@item
|
985
|
+
A anonymous mapping (i.e. not file-backed)
|
986
|
+
|
987
|
+
@item
|
988
|
+
@code{memfd_create()}, if the kernel supports it.
|
989
|
+
|
990
|
+
@item
|
991
|
+
A file created in the directory referenced by the environment variable
|
992
|
+
@code{LIBFFI_TMPDIR}.
|
993
|
+
|
994
|
+
@item
|
995
|
+
Likewise for the environment variable @code{TMPDIR}.
|
996
|
+
|
997
|
+
@item
|
998
|
+
A file created in @code{/tmp}.
|
999
|
+
|
1000
|
+
@item
|
1001
|
+
A file created in @code{/var/tmp}.
|
1002
|
+
|
1003
|
+
@item
|
1004
|
+
A file created in @code{/dev/shm}.
|
1005
|
+
|
1006
|
+
@item
|
1007
|
+
A file created in the user's home directory (@code{$HOME}).
|
1008
|
+
|
1009
|
+
@item
|
1010
|
+
A file created in any directory listed in @code{/etc/mtab}.
|
1011
|
+
|
1012
|
+
@item
|
1013
|
+
A file created in any directory listed in @code{/proc/mounts}.
|
1014
|
+
|
1015
|
+
@end itemize
|
1016
|
+
|
1017
|
+
If security settings prohibit using any of these for closures,
|
1018
|
+
@code{ffi_closure_alloc} will fail.
|
1019
|
+
|
956
1020
|
@node Missing Features
|
957
1021
|
@chapter Missing Features
|
958
1022
|
|
@@ -974,9 +1038,6 @@ The ``raw'' API is undocumented.
|
|
974
1038
|
The Go API is undocumented.
|
975
1039
|
@end itemize
|
976
1040
|
|
977
|
-
Note that variadic support is very new and tested on a relatively
|
978
|
-
small number of platforms.
|
979
|
-
|
980
1041
|
@node Index
|
981
1042
|
@unnumbered Index
|
982
1043
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
@set UPDATED
|
2
|
-
@set UPDATED-MONTH
|
3
|
-
@set EDITION 3.
|
4
|
-
@set VERSION 3.
|
1
|
+
@set UPDATED 23 October 2022
|
2
|
+
@set UPDATED-MONTH October 2022
|
3
|
+
@set EDITION 3.4.4
|
4
|
+
@set VERSION 3.4.4
|
@@ -3,24 +3,20 @@
|
|
3
3
|
/* Define if building universal (internal helper macro) */
|
4
4
|
#undef AC_APPLE_UNIVERSAL_BUILD
|
5
5
|
|
6
|
-
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
7
|
-
systems. This function is required for `alloca.c' support on those systems.
|
8
|
-
*/
|
9
|
-
#undef CRAY_STACKSEG_END
|
10
|
-
|
11
|
-
/* Define to 1 if using `alloca.c'. */
|
12
|
-
#undef C_ALLOCA
|
13
|
-
|
14
6
|
/* Define to the flags needed for the .section .eh_frame directive. */
|
15
7
|
#undef EH_FRAME_FLAGS
|
16
8
|
|
17
9
|
/* Define this if you want extra debugging. */
|
18
10
|
#undef FFI_DEBUG
|
19
11
|
|
12
|
+
/* Define this if you want statically defined trampolines */
|
13
|
+
#undef FFI_EXEC_STATIC_TRAMP
|
14
|
+
|
20
15
|
/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */
|
21
16
|
#undef FFI_EXEC_TRAMPOLINE_TABLE
|
22
17
|
|
23
|
-
/* Define this if you want to enable pax emulated trampolines
|
18
|
+
/* Define this if you want to enable pax emulated trampolines (experimental)
|
19
|
+
*/
|
24
20
|
#undef FFI_MMAP_EXEC_EMUTRAMP_PAX
|
25
21
|
|
26
22
|
/* Cannot use malloc on this target, so, we revert to alternative means */
|
@@ -32,11 +28,7 @@
|
|
32
28
|
/* Define this if you do not want support for aggregate types. */
|
33
29
|
#undef FFI_NO_STRUCTS
|
34
30
|
|
35
|
-
/* Define to 1 if you have
|
36
|
-
#undef HAVE_ALLOCA
|
37
|
-
|
38
|
-
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
|
39
|
-
*/
|
31
|
+
/* Define to 1 if you have the <alloca.h> header file. */
|
40
32
|
#undef HAVE_ALLOCA_H
|
41
33
|
|
42
34
|
/* Define if your assembler supports .cfi_* directives. */
|
@@ -76,23 +68,11 @@
|
|
76
68
|
/* Define to 1 if you have the `memcpy' function. */
|
77
69
|
#undef HAVE_MEMCPY
|
78
70
|
|
79
|
-
/* Define to 1 if you have the
|
80
|
-
#undef
|
81
|
-
|
82
|
-
/* Define to 1 if you have the `mkostemp' function. */
|
83
|
-
#undef HAVE_MKOSTEMP
|
71
|
+
/* Define to 1 if you have the `memfd_create' function. */
|
72
|
+
#undef HAVE_MEMFD_CREATE
|
84
73
|
|
85
|
-
/* Define
|
86
|
-
#undef
|
87
|
-
|
88
|
-
/* Define if mmap with MAP_ANON(YMOUS) works. */
|
89
|
-
#undef HAVE_MMAP_ANON
|
90
|
-
|
91
|
-
/* Define if mmap of /dev/zero works. */
|
92
|
-
#undef HAVE_MMAP_DEV_ZERO
|
93
|
-
|
94
|
-
/* Define if read-only mmap of a plain file works. */
|
95
|
-
#undef HAVE_MMAP_FILE
|
74
|
+
/* Define if your compiler supports pointer authentication. */
|
75
|
+
#undef HAVE_PTRAUTH
|
96
76
|
|
97
77
|
/* Define if .eh_frame sections should be read-only. */
|
98
78
|
#undef HAVE_RO_EH_FRAME
|
@@ -100,6 +80,9 @@
|
|
100
80
|
/* Define to 1 if you have the <stdint.h> header file. */
|
101
81
|
#undef HAVE_STDINT_H
|
102
82
|
|
83
|
+
/* Define to 1 if you have the <stdio.h> header file. */
|
84
|
+
#undef HAVE_STDIO_H
|
85
|
+
|
103
86
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
104
87
|
#undef HAVE_STDLIB_H
|
105
88
|
|
@@ -109,8 +92,8 @@
|
|
109
92
|
/* Define to 1 if you have the <string.h> header file. */
|
110
93
|
#undef HAVE_STRING_H
|
111
94
|
|
112
|
-
/* Define to 1 if you have the <sys/
|
113
|
-
#undef
|
95
|
+
/* Define to 1 if you have the <sys/memfd.h> header file. */
|
96
|
+
#undef HAVE_SYS_MEMFD_H
|
114
97
|
|
115
98
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
116
99
|
#undef HAVE_SYS_STAT_H
|
@@ -157,15 +140,9 @@
|
|
157
140
|
/* The size of `size_t', as computed by sizeof. */
|
158
141
|
#undef SIZEOF_SIZE_T
|
159
142
|
|
160
|
-
/*
|
161
|
-
|
162
|
-
|
163
|
-
STACK_DIRECTION > 0 => grows toward higher addresses
|
164
|
-
STACK_DIRECTION < 0 => grows toward lower addresses
|
165
|
-
STACK_DIRECTION = 0 => direction of growth unknown */
|
166
|
-
#undef STACK_DIRECTION
|
167
|
-
|
168
|
-
/* Define to 1 if you have the ANSI C header files. */
|
143
|
+
/* Define to 1 if all of the C90 standard headers exist (not just the ones
|
144
|
+
required in a freestanding environment). This macro is provided for
|
145
|
+
backward compatibility; new code need not use it. */
|
169
146
|
#undef STDC_HEADERS
|
170
147
|
|
171
148
|
/* Define if symbols are underscored. */
|
@@ -190,13 +167,14 @@
|
|
190
167
|
# endif
|
191
168
|
#endif
|
192
169
|
|
193
|
-
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
194
|
-
#undef size_t
|
195
|
-
|
196
170
|
|
197
171
|
#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
|
198
172
|
#ifdef LIBFFI_ASM
|
173
|
+
#ifdef __APPLE__
|
174
|
+
#define FFI_HIDDEN(name) .private_extern name
|
175
|
+
#else
|
199
176
|
#define FFI_HIDDEN(name) .hidden name
|
177
|
+
#endif
|
200
178
|
#else
|
201
179
|
#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
|
202
180
|
#endif
|