From: wanabe Date: 2010-03-11T00:56:31+09:00 Subject: [ruby-core:28593] Re: Ruby::DL vs Ruby::FFI Hello, 2010/3/9, NARUSE, Yui : > I confirmed Aaron's ext/dl can work with following > patched libffi on mswin32/VC9. > http://sourceware.org/ml/libffi-discuss/2010/msg00049.html > > If this also works on mswin64 and libffi merge this, > we can reimport Aaron's new ext/dl. > Please try this who have other than mswin32/VC9 and feedback to libffi. I tried new dl on mswin64, and built it with the following patch. But there is three issue at least. 1. object's memsize can't calculate correctly. It will be solved if libffi support ffi_raw_size() on mswin64. 2. test/dl/test_dl2.rb cause SEGV This is critical. 3. some tests fail. diff --git a/ext/dl/closure.c b/ext/dl/closure.c index 593d566..3d0c7ad 100644 --- a/ext/dl/closure.c +++ b/ext/dl/closure.c @@ -41,7 +41,9 @@ dlclosure_memsize(const void * ptr) if (ptr) { size += sizeof(*cls); +#if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API size += ffi_raw_size(cls->cif); +#endif size += sizeof(*cls->argv); size += sizeof(ffi_closure); } diff --git a/ext/dl/method.c b/ext/dl/method.c index 1bd0fa8..5705f55 100644 --- a/ext/dl/method.c +++ b/ext/dl/method.c @@ -43,7 +43,9 @@ dlfunction_memsize(const void *p) if (ptr) { size += sizeof(*ptr); +#if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API size += ffi_raw_size(ptr); +#endif } return size; } diff --git a/win32/win32.c b/win32/win32.c index 5189826..268c3c7 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5278,11 +5278,7 @@ _ftol2_sse(double d) int signbit(double x) { -#ifdef _M_IX86 int *ip = (int *)(&x + 1) - 1; return *ip < 0; -#else -# error not supported -#endif } #endif -- wanabe