ffi 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ffi might be problematic. Click here for more details.
- data/README.rdoc +19 -0
- data/Rakefile +65 -55
- data/ext/{AbstractMemory.c → ffi_c/AbstractMemory.c} +67 -40
- data/ext/{AbstractMemory.h → ffi_c/AbstractMemory.h} +10 -8
- data/ext/{AutoPointer.c → ffi_c/AutoPointer.c} +17 -8
- data/ext/{AutoPointer.h → ffi_c/AutoPointer.h} +0 -0
- data/ext/ffi_c/Buffer.c +136 -0
- data/ext/{Callback.c → ffi_c/Callback.c} +60 -35
- data/ext/{Callback.h → ffi_c/Callback.h} +1 -7
- data/ext/{Invoker.c → ffi_c/Invoker.c} +472 -102
- data/ext/ffi_c/MemoryPointer.c +146 -0
- data/ext/{MemoryPointer.h → ffi_c/MemoryPointer.h} +2 -7
- data/ext/ffi_c/NativeLibrary.c +149 -0
- data/ext/{NativeLibrary.h → ffi_c/NativeLibrary.h} +0 -0
- data/ext/ffi_c/NullPointer.c +104 -0
- data/ext/{Platform.c → ffi_c/Platform.c} +0 -0
- data/ext/{Platform.h → ffi_c/Platform.h} +0 -7
- data/ext/{Pointer.c → ffi_c/Pointer.c} +35 -15
- data/ext/{Pointer.h → ffi_c/Pointer.h} +4 -2
- data/ext/ffi_c/Struct.c +542 -0
- data/ext/ffi_c/Struct.h +26 -0
- data/ext/ffi_c/Types.c +76 -0
- data/ext/{Types.h → ffi_c/Types.h} +23 -28
- data/ext/{compat.h → ffi_c/compat.h} +2 -2
- data/ext/{extconf.rb → ffi_c/extconf.rb} +12 -7
- data/ext/ffi_c/ffi.c +99 -0
- data/ext/ffi_c/ffi.mk +23 -0
- data/ext/{libffi.darwin.mk → ffi_c/libffi.darwin.mk} +0 -0
- data/ext/ffi_c/libffi.mk +11 -0
- data/ext/{libffi → ffi_c/libffi}/ChangeLog +0 -0
- data/ext/{libffi → ffi_c/libffi}/ChangeLog.libffi +0 -0
- data/ext/{libffi → ffi_c/libffi}/ChangeLog.libgcj +0 -0
- data/ext/{libffi → ffi_c/libffi}/ChangeLog.v1 +0 -0
- data/ext/{libffi → ffi_c/libffi}/LICENSE +0 -0
- data/ext/{libffi → ffi_c/libffi}/Makefile.am +0 -0
- data/ext/{libffi → ffi_c/libffi}/Makefile.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/README +0 -0
- data/ext/{libffi → ffi_c/libffi}/TODO +0 -0
- data/ext/{libffi → ffi_c/libffi}/acinclude.m4 +0 -0
- data/ext/{libffi → ffi_c/libffi}/aclocal.m4 +0 -0
- data/ext/{libffi → ffi_c/libffi}/compile +0 -0
- data/ext/{libffi → ffi_c/libffi}/config.guess +0 -0
- data/ext/{libffi → ffi_c/libffi}/config.sub +0 -0
- data/ext/{libffi → ffi_c/libffi}/configure +0 -0
- data/ext/{libffi → ffi_c/libffi}/configure.ac +0 -0
- data/ext/{libffi → ffi_c/libffi}/configure.host +0 -0
- data/ext/{libffi → ffi_c/libffi}/depcomp +0 -0
- data/ext/{libffi → ffi_c/libffi}/doc/libffi.info +0 -0
- data/ext/{libffi → ffi_c/libffi}/doc/libffi.texi +0 -0
- data/ext/{libffi → ffi_c/libffi}/doc/stamp-vti +0 -0
- data/ext/{libffi → ffi_c/libffi}/doc/version.texi +0 -0
- data/ext/{libffi → ffi_c/libffi}/fficonfig.h.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/include/Makefile.am +0 -0
- data/ext/{libffi → ffi_c/libffi}/include/Makefile.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/include/ffi.h.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/include/ffi_common.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/install-sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/libffi.pc.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/libtool-version +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltcf-c.sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltcf-cxx.sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltcf-gcj.sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltconfig +0 -0
- data/ext/{libffi → ffi_c/libffi}/ltmain.sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/Makefile.am +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/Makefile.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/ffi.3 +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/ffi_call.3 +0 -0
- data/ext/{libffi → ffi_c/libffi}/man/ffi_prep_cif.3 +0 -0
- data/ext/{libffi → ffi_c/libffi}/mdate-sh +0 -0
- data/ext/{libffi → ffi_c/libffi}/missing +0 -0
- data/ext/{libffi → ffi_c/libffi}/mkinstalldirs +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/alpha/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/alpha/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/alpha/osf.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/arm/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/arm/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/arm/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/closures.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/cris/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/cris/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/cris/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/debug.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/dlmalloc.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/frv/eabi.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/frv/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/frv/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/ia64/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/ia64/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/ia64/ia64_flags.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/ia64/unix.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/java_raw_api.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m32r/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m32r/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m32r/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m68k/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m68k/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/m68k/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/mips/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/mips/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/mips/n32.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/mips/o32.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/pa/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/pa/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/pa/hpux32.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/pa/linux.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/aix.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/aix_closure.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/asm.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/darwin.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/darwin_closure.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/ffi_darwin.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/linux64.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/linux64_closure.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/ppc_closure.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/powerpc/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/prep_cif.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/raw_api.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/s390/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/s390/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/s390/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh64/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh64/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sh64/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sparc/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sparc/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sparc/v8.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/sparc/v9.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/types.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/darwin.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/darwin64.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/ffi.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/ffi64.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/ffitarget.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/freebsd.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/sysv.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/unix64.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/src/x86/win32.S +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/Makefile.am +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/Makefile.in +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/config/default.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/lib/libffi-dg.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/lib/target-libpath.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/lib/wrapper.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/call.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn0.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn4.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn5.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_fn6.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/closure_stdcall.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_12byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_16byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_18byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_19byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_1_1byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_20byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_20byte1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_24byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_2byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_3_1byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_3byte1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_3byte2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_4_1byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_4byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_5_1_byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_5byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_64byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_6_1_byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_6byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_7_1_byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_7byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_8byte.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_9byte1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_9byte2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_double.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_float.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_longdouble.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_pointer.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_sint16.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_sint32.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_sint64.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_uint16.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_uint32.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_align_uint64.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_double.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_float.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_schar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_sshort.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_sshortchar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_uchar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_ushort.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_multi_ushortchar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_schar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_sint.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_sshort.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_uchar.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_uint.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_ulonglong.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/cls_ushort.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/ffitest.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/float4.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/many.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/many_win32.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/negint.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct10.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct4.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct5.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct6.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct7.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct8.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/nested_struct9.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/problem1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/promotion.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/pyobjc-tc.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_dbl.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_dbl1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_dbl2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_fl.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_fl1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_fl2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_fl3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_ldl.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_ll.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_ll1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_sc.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_sl.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_uc.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/return_ul.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/strlen.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/strlen_win32.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct1.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct2.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct3.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct4.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct5.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct6.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct7.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct8.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.call/struct9.c +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.special/ffitestcxx.h +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.special/special.exp +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.special/unwindtest.cc +0 -0
- data/ext/{libffi → ffi_c/libffi}/testsuite/libffi.special/unwindtest_ffi_call.cc +0 -0
- data/ext/{libffi → ffi_c/libffi}/texinfo.tex +0 -0
- data/ext/{rbffi.h → ffi_c/rbffi.h} +1 -8
- data/lib/ffi/autopointer.rb +7 -7
- data/lib/ffi/buffer.rb +0 -25
- data/lib/ffi/ffi.rb +1 -0
- data/lib/ffi/library.rb +103 -37
- data/lib/ffi/memorypointer.rb +25 -28
- data/lib/ffi/platform.rb +2 -2
- data/lib/ffi/pointer.rb +21 -7
- data/lib/ffi/struct.rb +161 -179
- data/lib/ffi/types.rb +3 -3
- data/lib/ffi/union.rb +17 -0
- data/nbproject/configurations.xml +98 -88
- data/samples/hello.rb +1 -2
- data/samples/sample_helper.rb +6 -0
- data/{specs → spec/ffi}/buffer_spec.rb +0 -0
- data/{specs → spec/ffi}/callback_spec.rb +114 -89
- data/{specs → spec/ffi}/errno_spec.rb +0 -0
- data/spec/ffi/library_spec.rb +144 -0
- data/{specs → spec/ffi}/managed_struct_spec.rb +12 -1
- data/{specs → spec/ffi}/number_spec.rb +34 -16
- data/{specs → spec/ffi}/pointer_spec.rb +46 -2
- data/{specs → spec/ffi}/rbx/attach_function_spec.rb +2 -1
- data/{specs → spec/ffi}/rbx/memory_pointer_spec.rb +19 -19
- data/{specs → spec/ffi}/rbx/spec_helper.rb +0 -0
- data/{specs → spec/ffi}/rbx/struct_spec.rb +0 -0
- data/spec/ffi/spec_helper.rb +13 -0
- data/{specs → spec/ffi}/string_spec.rb +8 -0
- data/spec/ffi/struct_spec.rb +453 -0
- data/{specs → spec/ffi}/typedef_spec.rb +3 -3
- data/spec/ffi/union_spec.rb +60 -0
- data/{specs → spec/ffi}/variadic_spec.rb +0 -0
- data/spec/spec.opts +4 -0
- metadata +356 -334
- data/README +0 -0
- data/ext/Buffer.c +0 -98
- data/ext/MemoryPointer.c +0 -99
- data/ext/NativeLibrary.c +0 -90
- data/ext/Types.c +0 -76
- data/ext/ffi.c +0 -64
- data/ext/ffi.mk +0 -24
- data/ext/libffi.mk +0 -10
- data/gen/Rakefile +0 -12
- data/specs/library_spec.rb +0 -55
- data/specs/spec_helper.rb +0 -9
- data/specs/struct_spec.rb +0 -223
data/README
DELETED
File without changes
|
data/ext/Buffer.c
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
#include <stdbool.h>
|
2
|
-
#include <stdint.h>
|
3
|
-
#include <limits.h>
|
4
|
-
#include <ruby.h>
|
5
|
-
#include "rbffi.h"
|
6
|
-
#include "AbstractMemory.h"
|
7
|
-
|
8
|
-
typedef struct Buffer {
|
9
|
-
AbstractMemory memory;
|
10
|
-
caddr_t address; /* The C heap address */
|
11
|
-
VALUE parent;
|
12
|
-
} Buffer;
|
13
|
-
|
14
|
-
static VALUE buffer_allocate(VALUE self, VALUE size, VALUE count, VALUE clear);
|
15
|
-
static void buffer_release(Buffer* ptr);
|
16
|
-
static void buffer_mark(Buffer* ptr);
|
17
|
-
|
18
|
-
static VALUE classBuffer = Qnil;
|
19
|
-
|
20
|
-
static VALUE
|
21
|
-
buffer_allocate(VALUE self, VALUE size, VALUE count, VALUE clear)
|
22
|
-
{
|
23
|
-
Buffer* p;
|
24
|
-
VALUE retval;
|
25
|
-
unsigned long msize = NUM2LONG(size) * (count == Qnil ? 1 : NUM2LONG(count));
|
26
|
-
caddr_t memory;
|
27
|
-
|
28
|
-
memory = malloc(msize + 7);
|
29
|
-
if (memory == NULL) {
|
30
|
-
rb_raise(rb_eNoMemError, "Failed to allocate memory size=%lu bytes", msize);
|
31
|
-
}
|
32
|
-
retval = Data_Make_Struct(classBuffer, Buffer, buffer_mark, buffer_release, p);
|
33
|
-
p->address = memory;
|
34
|
-
p->memory.size = msize;
|
35
|
-
/* ensure the memory is aligned on at least a 8 byte boundary */
|
36
|
-
p->memory.address = (caddr_t) (((uintptr_t) memory + 0x7) & (uintptr_t) ~0x7UL);;
|
37
|
-
p->parent = Qnil;
|
38
|
-
if (TYPE(clear) == T_TRUE && p->memory.size > 0) {
|
39
|
-
memset(p->memory.address, 0, p->memory.size);
|
40
|
-
}
|
41
|
-
return retval;
|
42
|
-
}
|
43
|
-
|
44
|
-
static VALUE
|
45
|
-
buffer_plus(VALUE self, VALUE offset)
|
46
|
-
{
|
47
|
-
Buffer* ptr = (Buffer *) DATA_PTR(self);
|
48
|
-
Buffer* p;
|
49
|
-
VALUE retval;
|
50
|
-
long off = NUM2LONG(offset);
|
51
|
-
|
52
|
-
checkBounds(&ptr->memory, off, 1);
|
53
|
-
retval = Data_Make_Struct(classBuffer, Buffer, buffer_mark, buffer_release, p);
|
54
|
-
p->memory.address = ptr->memory.address + off;;
|
55
|
-
p->memory.size = ptr->memory.size - off;
|
56
|
-
p->parent = self;
|
57
|
-
return retval;
|
58
|
-
}
|
59
|
-
|
60
|
-
static VALUE
|
61
|
-
buffer_inspect(VALUE self)
|
62
|
-
{
|
63
|
-
Buffer* ptr = (Buffer *) DATA_PTR(self);
|
64
|
-
char tmp[100];
|
65
|
-
snprintf(tmp, sizeof(tmp), "#<Buffer size=%ld>", ptr->memory.size);
|
66
|
-
return rb_str_new2(tmp);
|
67
|
-
}
|
68
|
-
|
69
|
-
static void
|
70
|
-
buffer_release(Buffer* ptr)
|
71
|
-
{
|
72
|
-
if (ptr->parent == Qnil && ptr->address != NULL) {
|
73
|
-
free(ptr->address);
|
74
|
-
ptr->address = NULL;
|
75
|
-
}
|
76
|
-
xfree(ptr);
|
77
|
-
|
78
|
-
}
|
79
|
-
static void
|
80
|
-
buffer_mark(Buffer* ptr)
|
81
|
-
{
|
82
|
-
if (ptr->parent != Qnil) {
|
83
|
-
rb_gc_mark(ptr->parent);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
void
|
88
|
-
rb_FFI_Buffer_Init()
|
89
|
-
{
|
90
|
-
VALUE moduleFFI = rb_define_module("FFI");
|
91
|
-
classBuffer = rb_define_class_under(moduleFFI, "Buffer", rb_FFI_AbstractMemory_class);
|
92
|
-
rb_define_singleton_method(classBuffer, "__alloc_inout", buffer_allocate, 3);
|
93
|
-
rb_define_singleton_method(classBuffer, "__alloc_out", buffer_allocate, 3);
|
94
|
-
rb_define_singleton_method(classBuffer, "__alloc_in", buffer_allocate, 3);
|
95
|
-
rb_define_method(classBuffer, "inspect", buffer_inspect, 0);
|
96
|
-
rb_define_method(classBuffer, "+", buffer_plus, 1);
|
97
|
-
}
|
98
|
-
|
data/ext/MemoryPointer.c
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
#include <stdbool.h>
|
2
|
-
#include <stdint.h>
|
3
|
-
#include <limits.h>
|
4
|
-
#include <ruby.h>
|
5
|
-
#include "rbffi.h"
|
6
|
-
#include "AbstractMemory.h"
|
7
|
-
#include "Pointer.h"
|
8
|
-
#include "MemoryPointer.h"
|
9
|
-
|
10
|
-
typedef struct MemoryPointer {
|
11
|
-
AbstractMemory memory;
|
12
|
-
caddr_t address;
|
13
|
-
bool autorelease;
|
14
|
-
bool allocated;
|
15
|
-
} MemoryPointer;
|
16
|
-
|
17
|
-
static VALUE memptr_allocate(VALUE self, VALUE size, VALUE count, VALUE clear);
|
18
|
-
static void memptr_release(MemoryPointer* ptr);
|
19
|
-
|
20
|
-
VALUE rb_FFI_MemoryPointer_class;
|
21
|
-
static VALUE classMemoryPointer = Qnil;
|
22
|
-
|
23
|
-
static VALUE
|
24
|
-
memptr_allocate(VALUE self, VALUE size, VALUE count, VALUE clear)
|
25
|
-
{
|
26
|
-
MemoryPointer* p;
|
27
|
-
VALUE retval;
|
28
|
-
caddr_t memory;
|
29
|
-
unsigned long msize = NUM2LONG(size) * (count == Qnil ? 1 : NUM2LONG(count));
|
30
|
-
memory = malloc(msize + 7);
|
31
|
-
if (memory == NULL) {
|
32
|
-
rb_raise(rb_eNoMemError, "Failed to allocate memory size=%ld bytes", msize);
|
33
|
-
}
|
34
|
-
retval = Data_Make_Struct(classMemoryPointer, MemoryPointer, NULL, memptr_release, p);
|
35
|
-
p->address = memory;
|
36
|
-
p->autorelease = true;
|
37
|
-
p->memory.size = msize;
|
38
|
-
/* ensure the memory is aligned on at least a 8 byte boundary */
|
39
|
-
p->memory.address = (caddr_t) (((uintptr_t) memory + 0x7) & (uintptr_t) ~0x7UL);;
|
40
|
-
p->allocated = true;
|
41
|
-
if (TYPE(clear) == T_TRUE && p->memory.size > 0) {
|
42
|
-
memset(p->memory.address, 0, p->memory.size);
|
43
|
-
}
|
44
|
-
return retval;
|
45
|
-
}
|
46
|
-
|
47
|
-
|
48
|
-
static VALUE
|
49
|
-
memptr_inspect(VALUE self)
|
50
|
-
{
|
51
|
-
MemoryPointer* ptr = (MemoryPointer *) DATA_PTR(self);
|
52
|
-
char tmp[100];
|
53
|
-
snprintf(tmp, sizeof(tmp), "#<MemoryPointer address=%p size=%lu>", ptr->memory.address, ptr->memory.size);
|
54
|
-
return rb_str_new2(tmp);
|
55
|
-
}
|
56
|
-
|
57
|
-
static VALUE
|
58
|
-
memptr_free(VALUE self)
|
59
|
-
{
|
60
|
-
MemoryPointer* ptr = (MemoryPointer *) DATA_PTR(self);
|
61
|
-
if (ptr->allocated) {
|
62
|
-
if (ptr->address != NULL) {
|
63
|
-
free(ptr->address);
|
64
|
-
ptr->address = NULL;
|
65
|
-
}
|
66
|
-
ptr->allocated = false;
|
67
|
-
}
|
68
|
-
return self;
|
69
|
-
}
|
70
|
-
|
71
|
-
static VALUE
|
72
|
-
memptr_autorelease(VALUE self, VALUE autorelease)
|
73
|
-
{
|
74
|
-
MemoryPointer* ptr = (MemoryPointer *) DATA_PTR(self);
|
75
|
-
ptr->autorelease = autorelease == Qtrue;
|
76
|
-
return self;
|
77
|
-
}
|
78
|
-
|
79
|
-
static void
|
80
|
-
memptr_release(MemoryPointer* ptr)
|
81
|
-
{
|
82
|
-
if (ptr->autorelease && ptr->allocated && ptr->address != NULL) {
|
83
|
-
free(ptr->address);
|
84
|
-
ptr->address = NULL;
|
85
|
-
}
|
86
|
-
xfree(ptr);
|
87
|
-
|
88
|
-
}
|
89
|
-
|
90
|
-
void
|
91
|
-
rb_FFI_MemoryPointer_Init()
|
92
|
-
{
|
93
|
-
VALUE moduleFFI = rb_define_module("FFI");
|
94
|
-
rb_FFI_MemoryPointer_class = classMemoryPointer = rb_define_class_under(moduleFFI, "MemoryPointer", rb_FFI_Pointer_class);
|
95
|
-
rb_define_singleton_method(classMemoryPointer, "__allocate", memptr_allocate, 3);
|
96
|
-
rb_define_method(classMemoryPointer, "inspect", memptr_inspect, 0);
|
97
|
-
rb_define_method(classMemoryPointer, "autorelease=", memptr_autorelease, 1);
|
98
|
-
rb_define_method(classMemoryPointer, "free", memptr_free, 0);
|
99
|
-
}
|
data/ext/NativeLibrary.c
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
#include <sys/types.h>
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <stdint.h>
|
4
|
-
#include <dlfcn.h>
|
5
|
-
#include <ruby.h>
|
6
|
-
|
7
|
-
#include <ffi.h>
|
8
|
-
|
9
|
-
#include "rbffi.h"
|
10
|
-
#include "compat.h"
|
11
|
-
#include "Pointer.h"
|
12
|
-
#include "NativeLibrary.h"
|
13
|
-
|
14
|
-
static void library_free(Library* lib);
|
15
|
-
static VALUE classLibrary;
|
16
|
-
|
17
|
-
static VALUE
|
18
|
-
library_open(VALUE klass, VALUE libname, VALUE libflags)
|
19
|
-
{
|
20
|
-
VALUE retval;
|
21
|
-
Library* library;
|
22
|
-
int flags;
|
23
|
-
Check_Type(libflags, T_FIXNUM);
|
24
|
-
|
25
|
-
flags = libflags != Qnil ? NUM2UINT(libflags) : 0;
|
26
|
-
if (flags == 0) {
|
27
|
-
flags = RTLD_LAZY;
|
28
|
-
}
|
29
|
-
retval = Data_Make_Struct(klass, Library, NULL, library_free, library);
|
30
|
-
library->handle = dlopen(libname != Qnil ? StringValueCStr(libname) : NULL,
|
31
|
-
RTLD_LAZY);
|
32
|
-
if (library->handle == NULL) {
|
33
|
-
rb_raise(rb_eLoadError, "Could not open library '%s': %s",
|
34
|
-
libname != Qnil ? StringValueCStr(libname) : "[current process]",
|
35
|
-
dlerror());
|
36
|
-
}
|
37
|
-
rb_iv_set(retval, "@name", libname != Qnil ? libname : rb_str_new2("[current process]"));
|
38
|
-
return retval;
|
39
|
-
}
|
40
|
-
|
41
|
-
static VALUE
|
42
|
-
library_dlsym(VALUE self, VALUE name)
|
43
|
-
{
|
44
|
-
Library* library;
|
45
|
-
void* address = NULL;
|
46
|
-
Check_Type(name, T_STRING);
|
47
|
-
|
48
|
-
Data_Get_Struct(self, Library, library);
|
49
|
-
address = dlsym(library->handle, StringValueCStr(name));
|
50
|
-
return address != NULL ? rb_FFI_Pointer_new(address) : Qnil;
|
51
|
-
}
|
52
|
-
|
53
|
-
static VALUE
|
54
|
-
library_dlerror(VALUE self)
|
55
|
-
{
|
56
|
-
return rb_tainted_str_new2(dlerror());
|
57
|
-
}
|
58
|
-
|
59
|
-
static void
|
60
|
-
library_free(Library* library)
|
61
|
-
{
|
62
|
-
if (library != NULL) {
|
63
|
-
// dlclose() on MacOS tends to segfault - avoid it
|
64
|
-
#ifndef __APPLE__
|
65
|
-
if (library->handle != NULL) {
|
66
|
-
dlclose(library->handle);
|
67
|
-
}
|
68
|
-
#endif
|
69
|
-
library->handle = NULL;
|
70
|
-
xfree(library);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
|
-
void
|
75
|
-
rb_FFI_NativeLibrary_Init()
|
76
|
-
{
|
77
|
-
VALUE moduleFFI = rb_define_module("FFI");
|
78
|
-
classLibrary = rb_define_class_under(moduleFFI, "DynamicLibrary", rb_cObject);
|
79
|
-
rb_define_const(moduleFFI, "NativeLibrary", classLibrary); // backwards compat library
|
80
|
-
rb_define_singleton_method(classLibrary, "open", library_open, 2);
|
81
|
-
rb_define_method(classLibrary, "find_symbol", library_dlsym, 1);
|
82
|
-
rb_define_method(classLibrary, "last_error", library_dlerror, 0);
|
83
|
-
rb_define_attr(classLibrary, "name", 1, 0);
|
84
|
-
#define DEF(x) rb_define_const(classLibrary, "RTLD_" #x, UINT2NUM(RTLD_##x))
|
85
|
-
DEF(LAZY);
|
86
|
-
DEF(NOW);
|
87
|
-
DEF(GLOBAL);
|
88
|
-
DEF(LOCAL);
|
89
|
-
}
|
90
|
-
|
data/ext/Types.c
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
#include <ruby.h>
|
2
|
-
#include "Pointer.h"
|
3
|
-
#include "Types.h"
|
4
|
-
|
5
|
-
ffi_type*
|
6
|
-
rb_FFI_NativeTypeToFFI(NativeType type)
|
7
|
-
{
|
8
|
-
switch (type) {
|
9
|
-
case VOID:
|
10
|
-
return &ffi_type_void;
|
11
|
-
case INT8:
|
12
|
-
return &ffi_type_sint8;
|
13
|
-
case UINT8:
|
14
|
-
return &ffi_type_uint8;
|
15
|
-
case INT16:
|
16
|
-
return &ffi_type_sint16;
|
17
|
-
case UINT16:
|
18
|
-
return &ffi_type_uint16;
|
19
|
-
case INT32:
|
20
|
-
return &ffi_type_sint32;
|
21
|
-
case UINT32:
|
22
|
-
return &ffi_type_uint32;
|
23
|
-
case INT64:
|
24
|
-
return &ffi_type_sint64;
|
25
|
-
case UINT64:
|
26
|
-
return &ffi_type_uint64;
|
27
|
-
case FLOAT32:
|
28
|
-
return &ffi_type_float;
|
29
|
-
case FLOAT64:
|
30
|
-
return &ffi_type_double;
|
31
|
-
case STRING:
|
32
|
-
case RBXSTRING:
|
33
|
-
case POINTER:
|
34
|
-
case BUFFER_IN:
|
35
|
-
case BUFFER_OUT:
|
36
|
-
case BUFFER_INOUT:
|
37
|
-
return &ffi_type_pointer;
|
38
|
-
default:
|
39
|
-
return NULL;
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
VALUE
|
44
|
-
rb_FFI_NativeValueToRuby(NativeType type, const void* ptr)
|
45
|
-
{
|
46
|
-
switch (type) {
|
47
|
-
case VOID:
|
48
|
-
return Qnil;
|
49
|
-
case INT8:
|
50
|
-
return INT2NUM(*(char *) ptr);
|
51
|
-
case INT16:
|
52
|
-
return INT2NUM(*(short *) ptr);
|
53
|
-
case INT32:
|
54
|
-
return INT2NUM(*(int *) ptr);
|
55
|
-
case UINT8:
|
56
|
-
return UINT2NUM(*(unsigned char *) ptr);
|
57
|
-
case UINT16:
|
58
|
-
return UINT2NUM(*(unsigned short *) ptr);
|
59
|
-
case UINT32:
|
60
|
-
return UINT2NUM(*(unsigned int *) ptr);
|
61
|
-
case INT64:
|
62
|
-
return LL2NUM(*(signed long long *) ptr);
|
63
|
-
case UINT64:
|
64
|
-
return ULL2NUM(*(unsigned long long *) ptr);
|
65
|
-
case FLOAT32:
|
66
|
-
return rb_float_new(*(float *) ptr);
|
67
|
-
case FLOAT64:
|
68
|
-
return rb_float_new(*(double *) ptr);
|
69
|
-
case STRING:
|
70
|
-
return rb_tainted_str_new2(*(char **) ptr);
|
71
|
-
case POINTER:
|
72
|
-
return rb_FFI_Pointer_new(*(void **) ptr);
|
73
|
-
default:
|
74
|
-
rb_raise(rb_eRuntimeError, "Unknown type: %d", type);
|
75
|
-
}
|
76
|
-
}
|
data/ext/ffi.c
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
#include <sys/types.h>
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <dlfcn.h>
|
4
|
-
#include <ruby.h>
|
5
|
-
|
6
|
-
#include <ffi.h>
|
7
|
-
|
8
|
-
#include "rbffi.h"
|
9
|
-
#include "AbstractMemory.h"
|
10
|
-
#include "Pointer.h"
|
11
|
-
#include "MemoryPointer.h"
|
12
|
-
#include "AutoPointer.h"
|
13
|
-
#include "NativeLibrary.h"
|
14
|
-
#include "Platform.h"
|
15
|
-
#include "Types.h"
|
16
|
-
|
17
|
-
|
18
|
-
void Init_ffi();
|
19
|
-
|
20
|
-
static VALUE moduleFFI = Qnil;
|
21
|
-
static VALUE moduleNativeType = Qnil;
|
22
|
-
|
23
|
-
void
|
24
|
-
Init_ffi_c() {
|
25
|
-
moduleFFI = rb_define_module("FFI");
|
26
|
-
moduleNativeType = rb_define_module_under(moduleFFI, "NativeType");
|
27
|
-
|
28
|
-
rb_define_const(moduleNativeType, "VOID", INT2FIX(VOID));
|
29
|
-
rb_define_const(moduleNativeType, "INT8", INT2FIX(INT8));
|
30
|
-
rb_define_const(moduleNativeType, "UINT8", INT2FIX(UINT8));
|
31
|
-
rb_define_const(moduleNativeType, "INT16", INT2FIX(INT16));
|
32
|
-
rb_define_const(moduleNativeType, "UINT16", INT2FIX(UINT16));
|
33
|
-
rb_define_const(moduleNativeType, "INT32", INT2FIX(INT32));
|
34
|
-
rb_define_const(moduleNativeType, "UINT32", INT2FIX(UINT32));
|
35
|
-
rb_define_const(moduleNativeType, "INT64", INT2FIX(INT64));
|
36
|
-
rb_define_const(moduleNativeType, "UINT64", INT2FIX(UINT64));
|
37
|
-
rb_define_const(moduleNativeType, "FLOAT32", INT2FIX(FLOAT32));
|
38
|
-
rb_define_const(moduleNativeType, "FLOAT64", INT2FIX(FLOAT64));
|
39
|
-
rb_define_const(moduleNativeType, "POINTER", INT2FIX(POINTER));
|
40
|
-
rb_define_const(moduleNativeType, "STRING", INT2FIX(STRING));
|
41
|
-
rb_define_const(moduleNativeType, "RBXSTRING", INT2FIX(RBXSTRING));
|
42
|
-
rb_define_const(moduleNativeType, "CHAR_ARRAY", INT2FIX(CHAR_ARRAY));
|
43
|
-
rb_define_const(moduleNativeType, "BUFFER_IN", INT2FIX(BUFFER_IN));
|
44
|
-
rb_define_const(moduleNativeType, "BUFFER_OUT", INT2FIX(BUFFER_OUT));
|
45
|
-
rb_define_const(moduleNativeType, "BUFFER_INOUT", INT2FIX(BUFFER_INOUT));
|
46
|
-
rb_define_const(moduleNativeType, "VARARGS", INT2FIX(VARARGS));
|
47
|
-
if (sizeof(long) == 4) {
|
48
|
-
rb_define_const(moduleNativeType, "LONG", INT2FIX(INT32));
|
49
|
-
rb_define_const(moduleNativeType, "ULONG", INT2FIX(UINT32));
|
50
|
-
} else {
|
51
|
-
rb_define_const(moduleNativeType, "LONG", INT2FIX(INT64));
|
52
|
-
rb_define_const(moduleNativeType, "ULONG", INT2FIX(UINT64));
|
53
|
-
}
|
54
|
-
rb_FFI_Platform_Init();
|
55
|
-
rb_FFI_AbstractMemory_Init();
|
56
|
-
rb_FFI_Pointer_Init();
|
57
|
-
rb_FFI_AutoPointer_Init();
|
58
|
-
rb_FFI_MemoryPointer_Init();
|
59
|
-
rb_FFI_Buffer_Init();
|
60
|
-
rb_FFI_Callback_Init();
|
61
|
-
rb_FFI_NativeLibrary_Init();
|
62
|
-
rb_FFI_Invoker_Init();
|
63
|
-
}
|
64
|
-
|
data/ext/ffi.mk
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- makefile -*-
|
2
|
-
|
3
|
-
CFLAGS += -Werror -Wformat
|
4
|
-
INCFLAGS += -I$(BUILD_DIR) -I$(LIBFFI_BUILD_DIR)/include
|
5
|
-
CPPFLAGS += -I$(BUILD_DIR) -I$(LIBFFI_BUILD_DIR)/include
|
6
|
-
LOCAL_LIBS += $(LIBFFI) -lpthread
|
7
|
-
|
8
|
-
FFI_MMAP_EXEC = -DFFI_MMAP_EXEC_WRIT
|
9
|
-
FFI_CFLAGS = $(FFI_MMAP_EXEC) $(OFLAGS)
|
10
|
-
BUILD_DIR = $(PWD)/build
|
11
|
-
LIBFFI_SRC_DIR = $(PWD)/$(srcdir)/libffi
|
12
|
-
LIBFFI_BUILD_DIR = $(BUILD_DIR)/libffi
|
13
|
-
LIBFFI = $(LIBFFI_BUILD_DIR)/.libs/libffi_convenience.a
|
14
|
-
FFI_CONFIGURE = sh $(LIBFFI_SRC_DIR)/configure --disable-static \
|
15
|
-
--with-pic=yes --disable-dependency-tracking
|
16
|
-
|
17
|
-
$(OBJS): $(LIBFFI)
|
18
|
-
|
19
|
-
clean: libffi_clean
|
20
|
-
|
21
|
-
libffi_clean::
|
22
|
-
$(RM) -r $(BUILD_DIR)
|
23
|
-
|
24
|
-
|