ffi 1.15.5 → 1.17.4
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +169 -0
- data/Gemfile +15 -3
- data/README.md +5 -3
- data/Rakefile +30 -12
- data/Steepfile +8 -0
- data/ext/ffi_c/AbstractMemory.c +99 -74
- data/ext/ffi_c/AbstractMemory.h +3 -2
- data/ext/ffi_c/ArrayType.c +51 -15
- data/ext/ffi_c/ArrayType.h +1 -0
- data/ext/ffi_c/Buffer.c +90 -33
- data/ext/ffi_c/Call.c +29 -12
- data/ext/ffi_c/Call.h +3 -2
- data/ext/ffi_c/DynamicLibrary.c +90 -27
- data/ext/ffi_c/Function.c +276 -110
- data/ext/ffi_c/Function.h +1 -0
- data/ext/ffi_c/FunctionInfo.c +81 -25
- data/ext/ffi_c/LastError.c +29 -11
- data/ext/ffi_c/MappedType.c +66 -23
- data/ext/ffi_c/MappedType.h +0 -2
- data/ext/ffi_c/MemoryPointer.c +36 -9
- data/ext/ffi_c/MethodHandle.c +7 -3
- data/ext/ffi_c/Pointer.c +82 -40
- data/ext/ffi_c/Pointer.h +1 -0
- data/ext/ffi_c/Struct.c +166 -84
- data/ext/ffi_c/Struct.h +7 -4
- data/ext/ffi_c/StructByValue.c +48 -16
- data/ext/ffi_c/StructLayout.c +259 -73
- data/ext/ffi_c/Type.c +120 -51
- data/ext/ffi_c/Type.h +3 -1
- data/ext/ffi_c/Types.c +8 -2
- data/ext/ffi_c/Types.h +0 -1
- data/ext/ffi_c/Variadic.c +71 -26
- data/ext/ffi_c/compat.h +22 -22
- data/ext/ffi_c/extconf.rb +19 -2
- data/ext/ffi_c/ffi.c +4 -0
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/Makefile.am +28 -16
- data/ext/ffi_c/libffi/Makefile.in +138 -84
- data/ext/ffi_c/libffi/README.md +189 -108
- data/ext/ffi_c/libffi/acinclude.m4 +16 -112
- data/ext/ffi_c/libffi/{.travis/compile → compile} +4 -7
- data/ext/ffi_c/libffi/config.guess +695 -570
- data/ext/ffi_c/libffi/config.sub +217 -95
- data/ext/ffi_c/libffi/configure +4642 -3901
- data/ext/ffi_c/libffi/configure.ac +83 -33
- data/ext/ffi_c/libffi/configure.host +31 -12
- data/ext/ffi_c/libffi/doc/Makefile.in +13 -6
- data/ext/ffi_c/libffi/doc/libffi.texi +108 -36
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +15 -50
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +144 -60
- data/ext/ffi_c/libffi/include/Makefile.am +1 -1
- data/ext/ffi_c/libffi/include/Makefile.in +14 -9
- data/ext/ffi_c/libffi/include/ffi.h.in +73 -60
- data/ext/ffi_c/libffi/include/ffi_cfi.h +23 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +50 -2
- data/ext/ffi_c/libffi/include/tramp.h +45 -0
- data/ext/ffi_c/libffi/install-sh +92 -69
- data/ext/ffi_c/libffi/libffi.map.in +18 -1
- data/ext/ffi_c/libffi/libtool-version +2 -2
- data/ext/ffi_c/libffi/ltmain.sh +518 -333
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +28 -11
- 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 +13 -3
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -45
- data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
- data/ext/ffi_c/libffi/man/Makefile.in +13 -6
- data/ext/ffi_c/libffi/missing +1 -1
- data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +2 -2
- data/ext/ffi_c/libffi/msvcc.sh +1 -1
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +177 -57
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +2 -2
- data/ext/ffi_c/libffi/src/aarch64/internal.h +78 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +347 -93
- data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
- data/ext/ffi_c/libffi/src/arc/ffi.c +328 -147
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +62 -17
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +3 -3
- data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +114 -43
- data/ext/ffi_c/libffi/src/closures.c +137 -51
- data/ext/ffi_c/libffi/src/debug.c +2 -2
- data/ext/ffi_c/libffi/src/dlmalloc.c +7 -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/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 +31 -14
- data/ext/ffi_c/libffi/src/mips/ffi.c +250 -67
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +9 -4
- data/ext/ffi_c/libffi/src/mips/n32.S +197 -33
- data/ext/ffi_c/libffi/src/mips/o32.S +65 -4
- data/ext/ffi_c/libffi/src/moxie/ffi.c +47 -22
- data/ext/ffi_c/libffi/src/or1k/ffi.c +27 -14
- data/ext/ffi_c/libffi/src/pa/ffi.c +32 -33
- data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +22 -8
- data/ext/ffi_c/libffi/src/pa/hpux32.S +83 -36
- data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +86 -35
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +19 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +36 -24
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +27 -20
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +26 -16
- data/ext/ffi_c/libffi/src/powerpc/internal.h +10 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +2 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +49 -0
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +24 -0
- data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +22 -5
- data/ext/ffi_c/libffi/src/riscv/ffi.c +74 -18
- data/ext/ffi_c/libffi/src/riscv/internal.h +7 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +24 -0
- data/ext/ffi_c/libffi/src/s390/ffi.c +28 -1
- data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +38 -0
- data/ext/ffi_c/libffi/src/sparc/ffi.c +16 -0
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +23 -1
- data/ext/ffi_c/libffi/src/tramp.c +721 -0
- data/ext/ffi_c/libffi/src/types.c +26 -6
- data/ext/ffi_c/libffi/src/wasm/ffi.c +798 -0
- data/ext/ffi_c/libffi/src/wasm/ffitarget.h +79 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +102 -37
- data/ext/ffi_c/libffi/src/x86/ffi64.c +71 -13
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +6 -5
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +44 -1
- 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 +173 -41
- data/ext/ffi_c/libffi/src/x86/sysv_intel.S +92 -91
- data/ext/ffi_c/libffi/src/x86/unix64.S +96 -6
- data/ext/ffi_c/libffi/src/x86/win64.S +20 -7
- 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.in +95 -121
- data/ext/ffi_c/libffi.bsd.mk +2 -2
- data/ext/ffi_c/libffi.darwin.mk +2 -2
- data/ext/ffi_c/libffi.gnu.mk +2 -2
- data/ext/ffi_c/libffi.mk +5 -0
- data/ext/ffi_c/rbffi.h +1 -1
- data/ffi.gemspec +9 -8
- data/lib/ffi/autopointer.rb +14 -31
- data/lib/ffi/compat.rb +54 -0
- data/lib/ffi/data_converter.rb +2 -2
- data/lib/ffi/dynamic_library.rb +118 -0
- data/lib/ffi/enum.rb +18 -12
- data/lib/ffi/ffi.rb +62 -0
- data/lib/ffi/function.rb +94 -0
- data/lib/ffi/io.rb +2 -2
- data/lib/ffi/library.rb +88 -88
- data/lib/ffi/library_path.rb +109 -0
- data/lib/ffi/managedstruct.rb +1 -1
- data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
- data/lib/ffi/platform/aarch64-windows/types.conf +52 -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/loongarch64-linux/types.conf +141 -0
- data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
- data/lib/ffi/platform.rb +15 -13
- data/lib/ffi/pointer.rb +6 -6
- data/lib/ffi/struct.rb +6 -5
- data/lib/ffi/struct_by_reference.rb +1 -1
- data/lib/ffi/struct_layout.rb +3 -3
- data/lib/ffi/struct_layout_builder.rb +9 -9
- data/lib/ffi/types.rb +65 -37
- data/lib/ffi/variadic.rb +19 -8
- data/lib/ffi/version.rb +1 -1
- data/samples/hello_ractor.rb +19 -0
- data/samples/qsort_ractor.rb +36 -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/errno.rbs +8 -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/platform.rbs +49 -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 +29 -0
- data.tar.gz.sig +0 -0
- metadata +79 -299
- metadata.gz.sig +0 -0
- data/ext/ffi_c/libffi/.appveyor.yml +0 -66
- data/ext/ffi_c/libffi/.gitattributes +0 -4
- data/ext/ffi_c/libffi/.github/issue_template.md +0 -10
- data/ext/ffi_c/libffi/.gitignore +0 -38
- data/ext/ffi_c/libffi/.travis/ar-lib +0 -270
- data/ext/ffi_c/libffi/.travis/bfin-sim.exp +0 -58
- data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +0 -14
- data/ext/ffi_c/libffi/.travis/build-in-container.sh +0 -12
- data/ext/ffi_c/libffi/.travis/build.sh +0 -142
- data/ext/ffi_c/libffi/.travis/install.sh +0 -71
- data/ext/ffi_c/libffi/.travis/m32r-sim.exp +0 -58
- data/ext/ffi_c/libffi/.travis/moxie-sim.exp +0 -60
- data/ext/ffi_c/libffi/.travis/or1k-sim.exp +0 -58
- data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +0 -58
- data/ext/ffi_c/libffi/.travis/site.exp +0 -27
- data/ext/ffi_c/libffi/.travis/wine-sim.exp +0 -55
- data/ext/ffi_c/libffi/.travis.yml +0 -83
- data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
- data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
- data/ext/ffi_c/libffi/testsuite/Makefile.am +0 -122
- data/ext/ffi_c/libffi/testsuite/config/default.exp +0 -1
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +0 -660
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +0 -283
- data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +0 -28
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +0 -50
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +0 -63
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +0 -1745
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +0 -2885
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +0 -743
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +0 -54
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +0 -26
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +0 -138
- data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +0 -60
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +0 -62
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +0 -107
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +0 -57
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +0 -70
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -52
- data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +0 -46
- data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +0 -127
- data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +0 -59
- data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c +0 -114
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +0 -35
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +0 -34
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +0 -41
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +0 -38
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +0 -38
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +0 -38
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +0 -49
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +0 -57
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +0 -60
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +0 -64
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +0 -66
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +0 -64
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +0 -81
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +0 -68
- data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +0 -196
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +0 -121
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +0 -123
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +0 -125
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +0 -67
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +0 -89
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +0 -81
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +0 -81
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +0 -82
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +0 -89
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +0 -92
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +0 -95
- data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +0 -94
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +0 -95
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +0 -96
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +0 -102
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +0 -89
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +0 -93
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +0 -113
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +0 -95
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +0 -95
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +0 -98
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +0 -109
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +0 -98
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +0 -124
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +0 -113
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +0 -99
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +0 -117
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +0 -97
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +0 -88
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +0 -93
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +0 -92
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +0 -132
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +0 -115
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +0 -95
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +0 -92
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +0 -93
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +0 -66
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +0 -105
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +0 -61
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +0 -70
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +0 -55
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +0 -74
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +0 -142
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +0 -114
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar_va.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +0 -45
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +0 -47
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +0 -43
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort_va.c +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.closures/err_bad_abi.c +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +0 -138
- data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +0 -343
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +0 -152
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +0 -161
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +0 -134
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +0 -121
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +0 -110
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +0 -112
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +0 -131
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +0 -111
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +0 -131
- data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +0 -131
- data/ext/ffi_c/libffi/testsuite/libffi.closures/problem1.c +0 -90
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large.c +0 -145
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large2.c +0 -148
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +0 -124
- data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +0 -125
- data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +0 -70
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +0 -117
- data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +0 -54
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +0 -91
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +0 -42
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +0 -71
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +0 -80
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +0 -16
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +0 -51
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +0 -7
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +0 -86
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +0 -78
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +0 -37
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +0 -41
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +0 -44
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +0 -10
- data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +0 -34
- data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +0 -28
- data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +0 -1
- data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +0 -36
- data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +0 -19
- data/lib/ffi/tools/types_generator.rb +0 -137
- data/rakelib/ffi_gem_helper.rb +0 -65
- /data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +0 -0
data/lib/ffi/data_converter.rb
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
module FFI
|
|
32
32
|
# This module is used to extend somes classes and give then a common API.
|
|
33
33
|
#
|
|
34
|
-
# Most of methods defined here must be
|
|
34
|
+
# Most of methods defined here must be overridden.
|
|
35
35
|
module DataConverter
|
|
36
36
|
# Get native type.
|
|
37
37
|
#
|
|
@@ -41,7 +41,7 @@ module FFI
|
|
|
41
41
|
# Get native type from +type+.
|
|
42
42
|
#
|
|
43
43
|
# @overload native_type
|
|
44
|
-
# @raise {NotImplementedError} This method must be
|
|
44
|
+
# @raise {NotImplementedError} This method must be overridden.
|
|
45
45
|
def native_type(type = nil)
|
|
46
46
|
if type
|
|
47
47
|
@native_type = FFI.find_type(type)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2008-2010 Wayne Meissner
|
|
3
|
+
#
|
|
4
|
+
# This file is part of ruby-ffi.
|
|
5
|
+
#
|
|
6
|
+
# All rights reserved.
|
|
7
|
+
#
|
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
|
9
|
+
# modification, are permitted provided that the following conditions are met:
|
|
10
|
+
#
|
|
11
|
+
# * Redistributions of source code must retain the above copyright notice, this
|
|
12
|
+
# list of conditions and the following disclaimer.
|
|
13
|
+
# * Redistributions in binary form must reproduce the above copyright notice
|
|
14
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
# and/or other materials provided with the distribution.
|
|
16
|
+
# * Neither the name of the Ruby FFI project nor the names of its contributors
|
|
17
|
+
# may be used to endorse or promote products derived from this software
|
|
18
|
+
# without specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.#
|
|
30
|
+
|
|
31
|
+
module FFI
|
|
32
|
+
class DynamicLibrary
|
|
33
|
+
SEARCH_PATH = []
|
|
34
|
+
|
|
35
|
+
# The following search paths are tried, if the library could not be loaded in the first attempt.
|
|
36
|
+
# They are only executed on Macos in the following order:
|
|
37
|
+
if FFI::Platform.mac?
|
|
38
|
+
|
|
39
|
+
# 1. Try library paths possibly defined in LD_LIBRARY_PATH DYLD_LIBRARY_PATH first.
|
|
40
|
+
# This is because dlopen doesn't respect LD_LIBRARY_PATH and DYLD_LIBRARY_PATH is deleted by SIP-protected binaries.
|
|
41
|
+
# See here for details: https://github.com/ffi/ffi/issues/923#issuecomment-1872565313
|
|
42
|
+
%w[LD_LIBRARY_PATH DYLD_LIBRARY_PATH].each do |custom_path|
|
|
43
|
+
SEARCH_PATH.concat ENV.fetch(custom_path,"").split(File::PATH_SEPARATOR)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# 2. Then on macos/arm64 try /opt/homebrew/lib, since this is a typical standard directory.
|
|
47
|
+
# FFI is often used together with homebrew, so that we hardcode the path for arm64 here.
|
|
48
|
+
if FFI::Platform::ARCH == 'aarch64'
|
|
49
|
+
SEARCH_PATH << '/opt/homebrew/lib'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# 3. Then try typical system directories starting with the /local/ directory first.
|
|
53
|
+
#
|
|
54
|
+
# /usr/local/lib is used by homebrow on x86_64.
|
|
55
|
+
# /opt/local/lib is used by MacPorts and Fink.
|
|
56
|
+
# /usr/lib is there, because it was always there.
|
|
57
|
+
SEARCH_PATH.concat %w[/opt/local/lib /usr/local/lib /usr/lib]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# On Linux the library lookup paths are usually defined through /etc/ld.so.conf, which can be changed at will with root permissions.
|
|
61
|
+
# Also LD_LIBRARY_PATH is respected by the dynamic loader, so that there's usually no need and no advantage to do a fallback handling.
|
|
62
|
+
#
|
|
63
|
+
# Windows has it's own library lookup logic, very different to what we do here.
|
|
64
|
+
# See: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#user-content-dll-loading
|
|
65
|
+
|
|
66
|
+
FFI.make_shareable(SEARCH_PATH)
|
|
67
|
+
SEARCH_PATH_MESSAGE = "Searched in <system library path>#{ SEARCH_PATH.map{|a| ', ' + a}.join }".freeze
|
|
68
|
+
|
|
69
|
+
def self.load_library(name, flags)
|
|
70
|
+
if name == FFI::CURRENT_PROCESS
|
|
71
|
+
FFI::DynamicLibrary.open(nil, RTLD_LAZY | RTLD_LOCAL)
|
|
72
|
+
else
|
|
73
|
+
flags ||= RTLD_LAZY | RTLD_LOCAL
|
|
74
|
+
|
|
75
|
+
libnames = (name.is_a?(::Array) ? name : [name])
|
|
76
|
+
libnames = libnames.map(&:to_s).map { |n| [n, FFI.map_library_name(n)].uniq }.flatten.compact
|
|
77
|
+
errors = []
|
|
78
|
+
|
|
79
|
+
libnames.each do |libname|
|
|
80
|
+
lib = try_load(libname, flags, errors)
|
|
81
|
+
return lib if lib
|
|
82
|
+
|
|
83
|
+
unless libname.start_with?("/")
|
|
84
|
+
SEARCH_PATH.each do |prefix|
|
|
85
|
+
path = "#{prefix}/#{libname}"
|
|
86
|
+
if File.exist?(path)
|
|
87
|
+
lib = try_load(path, flags, errors)
|
|
88
|
+
return lib if lib
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
raise LoadError, [*errors, SEARCH_PATH_MESSAGE].join(".\n")
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
private_class_method :load_library
|
|
98
|
+
|
|
99
|
+
def self.try_load(libname, flags, errors)
|
|
100
|
+
begin
|
|
101
|
+
lib = FFI::DynamicLibrary.open(libname, flags)
|
|
102
|
+
return lib if lib
|
|
103
|
+
|
|
104
|
+
# LoadError for C ext & JRuby, RuntimeError for TruffleRuby
|
|
105
|
+
rescue LoadError, RuntimeError => ex
|
|
106
|
+
if ex.message =~ /(([^ \t()])+\.so([^ \t:()])*):([ \t])*(invalid ELF header|file too short|invalid file format)/
|
|
107
|
+
if File.binread($1) =~ /(?:GROUP|INPUT) *\( *([^ \)]+)/
|
|
108
|
+
return try_load($1, flags, errors)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
errors << ex
|
|
113
|
+
nil
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
private_class_method :try_load
|
|
117
|
+
end
|
|
118
|
+
end
|
data/lib/ffi/enum.rb
CHANGED
|
@@ -35,7 +35,6 @@ module FFI
|
|
|
35
35
|
# An instance of this class permits to manage {Enum}s. In fact, Enums is a collection of {Enum}s.
|
|
36
36
|
class Enums
|
|
37
37
|
|
|
38
|
-
# @return [nil]
|
|
39
38
|
def initialize
|
|
40
39
|
@all_enums = Array.new
|
|
41
40
|
@tagged_enums = Hash.new
|
|
@@ -192,6 +191,7 @@ module FFI
|
|
|
192
191
|
# @param [nil, Symbol] tag name of new Bitmask
|
|
193
192
|
def initialize(*args)
|
|
194
193
|
@native_type = args.first.kind_of?(FFI::Type) ? args.shift : Type::INT
|
|
194
|
+
@signed = [Type::INT8, Type::INT16, Type::INT32, Type::INT64].include?(@native_type)
|
|
195
195
|
info, @tag = *args
|
|
196
196
|
@kv_map = Hash.new
|
|
197
197
|
unless info.nil?
|
|
@@ -220,7 +220,7 @@ module FFI
|
|
|
220
220
|
# @param [Symbol] query
|
|
221
221
|
# @return [Integer]
|
|
222
222
|
# @overload [](query)
|
|
223
|
-
# Get
|
|
223
|
+
# Get bitmask value from symbol array
|
|
224
224
|
# @param [Array<Symbol>] query
|
|
225
225
|
# @return [Integer]
|
|
226
226
|
# @overload [](*query)
|
|
@@ -240,7 +240,7 @@ module FFI
|
|
|
240
240
|
when Symbol
|
|
241
241
|
flat_query.inject(0) do |val, o|
|
|
242
242
|
v = @kv_map[o]
|
|
243
|
-
if v then val
|
|
243
|
+
if v then val | v else val end
|
|
244
244
|
end
|
|
245
245
|
when Integer, ->(o) { o.respond_to?(:to_int) }
|
|
246
246
|
val = flat_query.inject(0) { |mask, o| mask |= o.to_int }
|
|
@@ -260,35 +260,41 @@ module FFI
|
|
|
260
260
|
def to_native(query, ctx)
|
|
261
261
|
return 0 if query.nil?
|
|
262
262
|
flat_query = [query].flatten
|
|
263
|
-
flat_query.inject(0) do |val, o|
|
|
263
|
+
res = flat_query.inject(0) do |val, o|
|
|
264
264
|
case o
|
|
265
265
|
when Symbol
|
|
266
266
|
v = @kv_map[o]
|
|
267
267
|
raise ArgumentError, "invalid bitmask value, #{o.inspect}" unless v
|
|
268
|
-
val
|
|
268
|
+
val | v
|
|
269
269
|
when Integer
|
|
270
|
-
val
|
|
270
|
+
val | o
|
|
271
271
|
when ->(obj) { obj.respond_to?(:to_int) }
|
|
272
|
-
val
|
|
272
|
+
val | o.to_int
|
|
273
273
|
else
|
|
274
274
|
raise ArgumentError, "invalid bitmask value, #{o.inspect}"
|
|
275
275
|
end
|
|
276
276
|
end
|
|
277
|
+
# Take two's complement of positive values bigger than the max value
|
|
278
|
+
# for the type when native type is signed.
|
|
279
|
+
if @signed && res >= (1 << (@native_type.size * 8 - 1))
|
|
280
|
+
res = -(-res & ((1 << (@native_type.size * 8)) - 1))
|
|
281
|
+
end
|
|
282
|
+
res
|
|
277
283
|
end
|
|
278
284
|
|
|
279
285
|
# @param [Integer] val
|
|
280
286
|
# @param ctx unused
|
|
281
287
|
# @return [Array<Symbol, Integer>] list of symbol names corresponding to val, plus an optional remainder if some bits don't match any constant
|
|
282
288
|
def from_native(val, ctx)
|
|
283
|
-
|
|
289
|
+
flags = @kv_map.select { |_, v| v & val != 0 }
|
|
290
|
+
list = flags.keys
|
|
291
|
+
# force an unsigned value of the correct size
|
|
292
|
+
val &= (1 << (@native_type.size * 8)) - 1 if @signed
|
|
284
293
|
# If there are unmatch flags,
|
|
285
294
|
# return them in an integer,
|
|
286
295
|
# else information can be lost.
|
|
287
296
|
# Similar to Enum behavior.
|
|
288
|
-
remainder = val ^
|
|
289
|
-
v = @kv_map[o]
|
|
290
|
-
if v then tmp |= v else tmp end
|
|
291
|
-
end
|
|
297
|
+
remainder = val ^ flags.values.reduce(0, :|)
|
|
292
298
|
list.push remainder unless remainder == 0
|
|
293
299
|
return list
|
|
294
300
|
end
|
data/lib/ffi/ffi.rb
CHANGED
|
@@ -28,9 +28,11 @@
|
|
|
28
28
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
29
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
30
|
|
|
31
|
+
require 'ffi/compat'
|
|
31
32
|
require 'ffi/platform'
|
|
32
33
|
require 'ffi/data_converter'
|
|
33
34
|
require 'ffi/types'
|
|
35
|
+
require 'ffi/library_path'
|
|
34
36
|
require 'ffi/library'
|
|
35
37
|
require 'ffi/errno'
|
|
36
38
|
require 'ffi/abstract_memory'
|
|
@@ -45,3 +47,63 @@ require 'ffi/autopointer'
|
|
|
45
47
|
require 'ffi/variadic'
|
|
46
48
|
require 'ffi/enum'
|
|
47
49
|
require 'ffi/version'
|
|
50
|
+
require 'ffi/function'
|
|
51
|
+
|
|
52
|
+
module FFI
|
|
53
|
+
module ModernForkTracking
|
|
54
|
+
def _fork
|
|
55
|
+
pid = super
|
|
56
|
+
if pid == 0
|
|
57
|
+
FFI._async_cb_dispatcher_atfork_child
|
|
58
|
+
end
|
|
59
|
+
pid
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
module LegacyForkTracking
|
|
64
|
+
module KernelExt
|
|
65
|
+
def fork
|
|
66
|
+
if block_given?
|
|
67
|
+
super do
|
|
68
|
+
FFI._async_cb_dispatcher_atfork_child
|
|
69
|
+
yield
|
|
70
|
+
end
|
|
71
|
+
else
|
|
72
|
+
pid = super
|
|
73
|
+
FFI._async_cb_dispatcher_atfork_child if pid.nil?
|
|
74
|
+
pid
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
module KernelExtPrivate
|
|
80
|
+
include KernelExt
|
|
81
|
+
private :fork
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
module IOExt
|
|
85
|
+
def popen(*args)
|
|
86
|
+
return super unless args[0] == '-'
|
|
87
|
+
|
|
88
|
+
super(*args) do |pipe|
|
|
89
|
+
FFI._async_cb_dispatcher_atfork_child if pipe.nil?
|
|
90
|
+
yield pipe
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
ruby2_keywords :popen if respond_to?(:ruby2_keywords)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if Process.respond_to?(:_fork)
|
|
98
|
+
# The nice Ruby 3.1+ way of doing things
|
|
99
|
+
::Process.singleton_class.prepend(ModernForkTracking)
|
|
100
|
+
elsif Process.respond_to?(:fork)
|
|
101
|
+
# Barf. Old CRuby.
|
|
102
|
+
# Most of the inspiration for how to do this was stolen from ActiveSupport.
|
|
103
|
+
::Object.prepend(LegacyForkTracking::KernelExtPrivate)
|
|
104
|
+
::Object.singleton_class.prepend(LegacyForkTracking::KernelExt)
|
|
105
|
+
::Kernel.prepend(LegacyForkTracking::KernelExtPrivate)
|
|
106
|
+
::Kernel.singleton_class.prepend(LegacyForkTracking::KernelExt)
|
|
107
|
+
::IO.singleton_class.prepend(LegacyForkTracking::IOExt)
|
|
108
|
+
end
|
|
109
|
+
end
|
data/lib/ffi/function.rb
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2008-2010 JRuby project
|
|
3
|
+
#
|
|
4
|
+
# This file is part of ruby-ffi.
|
|
5
|
+
#
|
|
6
|
+
# All rights reserved.
|
|
7
|
+
#
|
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
|
9
|
+
# modification, are permitted provided that the following conditions are met:
|
|
10
|
+
#
|
|
11
|
+
# * Redistributions of source code must retain the above copyright notice, this
|
|
12
|
+
# list of conditions and the following disclaimer.
|
|
13
|
+
# * Redistributions in binary form must reproduce the above copyright notice
|
|
14
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
# and/or other materials provided with the distribution.
|
|
16
|
+
# * Neither the name of the Ruby FFI project nor the names of its contributors
|
|
17
|
+
# may be used to endorse or promote products derived from this software
|
|
18
|
+
# without specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
31
|
+
module FFI
|
|
32
|
+
class Function
|
|
33
|
+
# Only MRI allows function type queries
|
|
34
|
+
if private_method_defined?(:type)
|
|
35
|
+
# Retrieve the return type of the function
|
|
36
|
+
#
|
|
37
|
+
# This method returns FFI type returned by the function.
|
|
38
|
+
#
|
|
39
|
+
# @return [FFI::Type]
|
|
40
|
+
def return_type
|
|
41
|
+
type.return_type
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Retrieve Array of parameter types
|
|
45
|
+
#
|
|
46
|
+
# This method returns an Array of FFI types accepted as function parameters.
|
|
47
|
+
#
|
|
48
|
+
# @return [Array<FFI::Type>]
|
|
49
|
+
def param_types
|
|
50
|
+
type.param_types
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
if RUBY_PLATFORM == 'aarch64-mingw-ucrt'
|
|
55
|
+
# Use a workaround for https://github.com/libffi/libffi/issues/905
|
|
56
|
+
def attach(mod, name)
|
|
57
|
+
this = self
|
|
58
|
+
body = proc do |*args, &block|
|
|
59
|
+
this.call(*args, &block)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
mod.define_method(name, body)
|
|
63
|
+
mod.define_singleton_method(name, body)
|
|
64
|
+
|
|
65
|
+
# Store function Proc's for re-definition as Ractor-shareable in Library#freeze
|
|
66
|
+
funcs = mod.instance_variable_get("@ffi_function_procs")
|
|
67
|
+
unless funcs
|
|
68
|
+
funcs = {}
|
|
69
|
+
mod.instance_variable_set("@ffi_function_procs", funcs)
|
|
70
|
+
end
|
|
71
|
+
funcs[name] = self
|
|
72
|
+
|
|
73
|
+
self
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Stash the Function in a module variable so it can be inspected by attached_functions.
|
|
78
|
+
# On CRuby it also ensures that it does not get garbage collected.
|
|
79
|
+
module RegisterAttach
|
|
80
|
+
def attach(mod, name)
|
|
81
|
+
funcs = mod.instance_variable_defined?("@ffi_functions") && mod.instance_variable_get("@ffi_functions")
|
|
82
|
+
unless funcs
|
|
83
|
+
funcs = {}
|
|
84
|
+
mod.instance_variable_set("@ffi_functions", funcs)
|
|
85
|
+
end
|
|
86
|
+
funcs[name.to_sym] = self
|
|
87
|
+
# Jump to the native attach method of CRuby, JRuby or Tuffleruby
|
|
88
|
+
super
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
private_constant :RegisterAttach
|
|
92
|
+
prepend RegisterAttach
|
|
93
|
+
end
|
|
94
|
+
end
|
data/lib/ffi/io.rb
CHANGED
|
@@ -42,9 +42,9 @@ module FFI
|
|
|
42
42
|
|
|
43
43
|
# @param [#read] io io to read from
|
|
44
44
|
# @param [AbstractMemory] buf destination for data read from +io+
|
|
45
|
-
# @param [nil,
|
|
45
|
+
# @param [nil, Integer] len maximul number of bytes to read from +io+. If +nil+,
|
|
46
46
|
# read until end of file.
|
|
47
|
-
# @return [
|
|
47
|
+
# @return [Integer] length really read, in bytes
|
|
48
48
|
#
|
|
49
49
|
# A version of IO#read that reads data from an IO and put then into a native buffer.
|
|
50
50
|
#
|
data/lib/ffi/library.rb
CHANGED
|
@@ -28,10 +28,12 @@
|
|
|
28
28
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
29
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.#
|
|
30
30
|
|
|
31
|
+
require 'ffi/dynamic_library'
|
|
32
|
+
|
|
31
33
|
module FFI
|
|
32
|
-
CURRENT_PROCESS = USE_THIS_PROCESS_AS_LIBRARY = Object.new
|
|
34
|
+
CURRENT_PROCESS = USE_THIS_PROCESS_AS_LIBRARY = FFI.make_shareable(Object.new)
|
|
33
35
|
|
|
34
|
-
# @param [
|
|
36
|
+
# @param [String, FFI::LibraryPath] lib library name or LibraryPath object
|
|
35
37
|
# @return [String] library name formatted for current platform
|
|
36
38
|
# Transform a generic library name to a platform library name
|
|
37
39
|
# @example
|
|
@@ -43,15 +45,7 @@ module FFI
|
|
|
43
45
|
# FFI.map_library_name 'jpeg' # -> "jpeg.dll"
|
|
44
46
|
def self.map_library_name(lib)
|
|
45
47
|
# Mangle the library name to reflect the native library naming conventions
|
|
46
|
-
lib
|
|
47
|
-
|
|
48
|
-
if lib && File.basename(lib) == lib
|
|
49
|
-
lib = Platform::LIBPREFIX + lib unless lib =~ /^#{Platform::LIBPREFIX}/
|
|
50
|
-
r = Platform::IS_WINDOWS || Platform::IS_MAC ? "\\.#{Platform::LIBSUFFIX}$" : "\\.so($|\\.[1234567890]+)"
|
|
51
|
-
lib += ".#{Platform::LIBSUFFIX}" unless lib =~ /#{r}/
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
lib
|
|
48
|
+
LibraryPath.wrap(lib).to_s
|
|
55
49
|
end
|
|
56
50
|
|
|
57
51
|
# Exception raised when a function is not found in libraries
|
|
@@ -95,62 +89,11 @@ module FFI
|
|
|
95
89
|
def ffi_lib(*names)
|
|
96
90
|
raise LoadError.new("library names list must not be empty") if names.empty?
|
|
97
91
|
|
|
98
|
-
lib_flags = defined?(@ffi_lib_flags)
|
|
99
|
-
ffi_libs = names.map do |name|
|
|
92
|
+
lib_flags = defined?(@ffi_lib_flags) && @ffi_lib_flags
|
|
100
93
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
else
|
|
105
|
-
libnames = (name.is_a?(::Array) ? name : [ name ]).map(&:to_s).map { |n| [ n, FFI.map_library_name(n) ].uniq }.flatten.compact
|
|
106
|
-
lib = nil
|
|
107
|
-
errors = {}
|
|
108
|
-
|
|
109
|
-
libnames.each do |libname|
|
|
110
|
-
begin
|
|
111
|
-
orig = libname
|
|
112
|
-
lib = FFI::DynamicLibrary.open(libname, lib_flags)
|
|
113
|
-
break if lib
|
|
114
|
-
|
|
115
|
-
rescue Exception => ex
|
|
116
|
-
ldscript = false
|
|
117
|
-
if ex.message =~ /(([^ \t()])+\.so([^ \t:()])*):([ \t])*(invalid ELF header|file too short|invalid file format)/
|
|
118
|
-
if File.binread($1) =~ /(?:GROUP|INPUT) *\( *([^ \)]+)/
|
|
119
|
-
libname = $1
|
|
120
|
-
ldscript = true
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
if ldscript
|
|
125
|
-
retry
|
|
126
|
-
else
|
|
127
|
-
# TODO better library lookup logic
|
|
128
|
-
unless libname.start_with?("/") || FFI::Platform.windows?
|
|
129
|
-
path = ['/usr/lib/','/usr/local/lib/','/opt/local/lib/', '/opt/homebrew/lib/'].find do |pth|
|
|
130
|
-
File.exist?(pth + libname)
|
|
131
|
-
end
|
|
132
|
-
if path
|
|
133
|
-
libname = path + libname
|
|
134
|
-
retry
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
libr = (orig == libname ? orig : "#{orig} #{libname}")
|
|
139
|
-
errors[libr] = ex
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
if lib.nil?
|
|
145
|
-
raise LoadError.new(errors.values.join(".\n"))
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
# return the found lib
|
|
149
|
-
lib
|
|
150
|
-
end
|
|
94
|
+
@ffi_libs = names.map do |name|
|
|
95
|
+
FFI::DynamicLibrary.send(:load_library, name, lib_flags)
|
|
151
96
|
end
|
|
152
|
-
|
|
153
|
-
@ffi_libs = ffi_libs
|
|
154
97
|
end
|
|
155
98
|
|
|
156
99
|
# Set the calling convention for {#attach_function} and {#callback}
|
|
@@ -192,7 +135,7 @@ module FFI
|
|
|
192
135
|
# ffi_lib_flags(:lazy, :local) # => 5
|
|
193
136
|
#
|
|
194
137
|
# @param [Symbol, …] flags (see {FlagsMap})
|
|
195
|
-
# @return [
|
|
138
|
+
# @return [Integer] the new value
|
|
196
139
|
def ffi_lib_flags(*flags)
|
|
197
140
|
@ffi_lib_flags = flags.inject(0) { |result, f| result | FlagsMap[f] }
|
|
198
141
|
end
|
|
@@ -258,7 +201,7 @@ module FFI
|
|
|
258
201
|
end
|
|
259
202
|
raise LoadError unless function
|
|
260
203
|
|
|
261
|
-
invokers << if arg_types
|
|
204
|
+
invokers << if arg_types[-1] == FFI::NativeType::VARARGS
|
|
262
205
|
VariadicInvoker.new(function, arg_types, find_type(ret_type), options)
|
|
263
206
|
|
|
264
207
|
else
|
|
@@ -330,6 +273,7 @@ module FFI
|
|
|
330
273
|
# Attach C variable +cname+ to this module.
|
|
331
274
|
def attach_variable(mname, a1, a2 = nil)
|
|
332
275
|
cname, type = a2 ? [ a1, a2 ] : [ mname.to_s, a1 ]
|
|
276
|
+
mname = mname.to_sym
|
|
333
277
|
address = nil
|
|
334
278
|
ffi_libraries.each do |lib|
|
|
335
279
|
begin
|
|
@@ -343,10 +287,11 @@ module FFI
|
|
|
343
287
|
if type.is_a?(Class) && type < FFI::Struct
|
|
344
288
|
# If it is a global struct, just attach directly to the pointer
|
|
345
289
|
s = s = type.new(address) # Assigning twice to suppress unused variable warning
|
|
346
|
-
self.module_eval
|
|
347
|
-
|
|
290
|
+
self.module_eval(<<-code, __FILE__, __LINE__)
|
|
291
|
+
@ffi_gsvars = {} unless defined?(@ffi_gsvars)
|
|
292
|
+
@ffi_gsvars[#{mname.inspect}] = s
|
|
348
293
|
def self.#{mname}
|
|
349
|
-
|
|
294
|
+
@ffi_gsvars[#{mname.inspect}]
|
|
350
295
|
end
|
|
351
296
|
code
|
|
352
297
|
|
|
@@ -357,13 +302,14 @@ module FFI
|
|
|
357
302
|
#
|
|
358
303
|
# Attach to this module as mname/mname=
|
|
359
304
|
#
|
|
360
|
-
self.module_eval
|
|
361
|
-
|
|
305
|
+
self.module_eval(<<-code, __FILE__, __LINE__)
|
|
306
|
+
@ffi_gvars = {} unless defined?(@ffi_gvars)
|
|
307
|
+
@ffi_gvars[#{mname.inspect}] = s
|
|
362
308
|
def self.#{mname}
|
|
363
|
-
|
|
309
|
+
@ffi_gvars[#{mname.inspect}][:gvar]
|
|
364
310
|
end
|
|
365
311
|
def self.#{mname}=(value)
|
|
366
|
-
|
|
312
|
+
@ffi_gvars[#{mname.inspect}][:gvar] = value
|
|
367
313
|
end
|
|
368
314
|
code
|
|
369
315
|
|
|
@@ -449,6 +395,26 @@ module FFI
|
|
|
449
395
|
end
|
|
450
396
|
end
|
|
451
397
|
|
|
398
|
+
# @param [DataConverter, Type, Struct, Symbol] t type to find
|
|
399
|
+
# @return [Type]
|
|
400
|
+
# Find a type definition.
|
|
401
|
+
def find_type(t)
|
|
402
|
+
if t.kind_of?(Type)
|
|
403
|
+
t
|
|
404
|
+
|
|
405
|
+
elsif defined?(@ffi_typedefs) && @ffi_typedefs.has_key?(t)
|
|
406
|
+
@ffi_typedefs[t]
|
|
407
|
+
|
|
408
|
+
elsif t.is_a?(Class) && t < Struct
|
|
409
|
+
Type::POINTER
|
|
410
|
+
|
|
411
|
+
elsif t.is_a?(DataConverter)
|
|
412
|
+
# Add a typedef so next time the converter is used, it hits the cache
|
|
413
|
+
typedef Type::Mapped.new(t), t
|
|
414
|
+
|
|
415
|
+
end || FFI.find_type(t)
|
|
416
|
+
end
|
|
417
|
+
|
|
452
418
|
private
|
|
453
419
|
# Generic enum builder
|
|
454
420
|
# @param [Class] klass can be one of FFI::Enum or FFI::Bitmask
|
|
@@ -569,24 +535,58 @@ module FFI
|
|
|
569
535
|
@ffi_enums.__map_symbol(symbol)
|
|
570
536
|
end
|
|
571
537
|
|
|
572
|
-
#
|
|
573
|
-
#
|
|
574
|
-
#
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
538
|
+
# Retrieve all attached functions and their function signature
|
|
539
|
+
#
|
|
540
|
+
# This method returns a Hash of method names of attached functions connected by #attach_function and the corresponding function type.
|
|
541
|
+
# The function type responds to #return_type and #param_types which return the FFI types of the function signature.
|
|
542
|
+
#
|
|
543
|
+
# @return [Hash< Symbol => [FFI::Function, FFI::VariadicInvoker] >]
|
|
544
|
+
def attached_functions
|
|
545
|
+
@ffi_functions || {}
|
|
546
|
+
end
|
|
578
547
|
|
|
579
|
-
|
|
580
|
-
|
|
548
|
+
# Retrieve all attached variables and their type
|
|
549
|
+
#
|
|
550
|
+
# This method returns a Hash of variable names and the corresponding type or variables connected by #attach_variable .
|
|
551
|
+
#
|
|
552
|
+
# @return [Hash< Symbol => ffi_type >]
|
|
553
|
+
def attached_variables
|
|
554
|
+
(
|
|
555
|
+
(defined?(@ffi_gsvars) ? @ffi_gsvars : {}).map do |name, gvar|
|
|
556
|
+
[name, gvar.class]
|
|
557
|
+
end +
|
|
558
|
+
(defined?(@ffi_gvars) ? @ffi_gvars : {}).map do |name, gvar|
|
|
559
|
+
[name, gvar.layout[:gvar].type]
|
|
560
|
+
end
|
|
561
|
+
).to_h
|
|
562
|
+
end
|
|
581
563
|
|
|
582
|
-
|
|
583
|
-
|
|
564
|
+
# Freeze all definitions of the module
|
|
565
|
+
#
|
|
566
|
+
# This freezes the module's definitions, so that it can be used in a Ractor.
|
|
567
|
+
# No further functions or variables can be attached and no further enums or typedefs can be created in this module afterwards.
|
|
568
|
+
def freeze
|
|
569
|
+
# @ffi_function_procs is only used on aarch64-mingw-ucrt
|
|
570
|
+
instance_variable_get("@ffi_function_procs")&.each do |name, func|
|
|
571
|
+
# Redefine attached functions as Ractor-shareable.
|
|
572
|
+
# The function Proc can't be shareable from the beginning, since it references enums and typedefs.
|
|
573
|
+
this = FFI.make_shareable(func)
|
|
574
|
+
body = FFI.shareable_proc(self: nil) do |*args, &block|
|
|
575
|
+
this.call(*args, &block)
|
|
576
|
+
end
|
|
577
|
+
undef_method(name)
|
|
578
|
+
singleton_class.undef_method(name)
|
|
584
579
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
580
|
+
define_method(name, body)
|
|
581
|
+
define_singleton_method(name, body)
|
|
582
|
+
end
|
|
588
583
|
|
|
589
|
-
|
|
584
|
+
instance_variables.each do |name|
|
|
585
|
+
var = instance_variable_get(name)
|
|
586
|
+
FFI.make_shareable(var)
|
|
587
|
+
end
|
|
588
|
+
super
|
|
589
|
+
nil
|
|
590
590
|
end
|
|
591
591
|
end
|
|
592
592
|
end
|