On 15-12-2011 09:14, Alex Rønne Petersen wrote:
Hi Andrej,
Sorry for the late response (for some reason, my news reader had marked
this thread as read).
> There's a few DLL's floating around for libffi, however none of them
> seem to have the symbol "ffi_prep_cif_var" which seems to be needed
> for variadic functions.
>
> I can version variadic support out and compile your bindings, the
> tests will work fine on win32.
> I've also tried compiling libffi on my own but had no success.
ffi_prep_cif_var doesn't seem to be available in any Windows builds
(Cygwin, MinGW, or otherwise) of libffi for whatever reason. I'll
version it out on Windows for now, as you suggested.
I haven't managed to get a MinGW build of libffi working so far, but I
did manage to get one working under Cygwin. Build libffi like this:
$ ./configure --enable-static=yes --enable-shared=no
$ make
Now you should have i686-pc-cygwin/.libs/libffi.a.
You'll also need your Cygwin installation's libgcc.a:
$ cd i686-pc-cygwin/.libs
$ ar -r libffi.a /lib/gcc/i686-pc-cygwin/4.5.3/libgcc.a
Now you need to convert the .a to an OMF .lib. You'll need objconv.zip
from this page: http://www.agner.org/optimize/
$ objconv -fomf -nu libffi.a libffi.lib
libffi.lib should now be linkable with DMD.
(I long for the day DMD doesn't use OMF.)
> I can make a pull with the import lib, the DLL (it's only 99KB), and
> the versioned out sections, if you'd like that.
I prefer keeping the binaries out of Git for various portability,
licensing, etc issues. That being said, I think we could upload
.libs/.dlls as downloads on the GitHub page. The question is whether we
should put .libs or .dlls there? Personally, I think .libs are easier to
work with when using DMD.
Thanks for the input!
- Alex
Correction: It seems as though that function has disappeared on my Linux
system! It has most probably been deprecated entirely, so I have just
removed it from libffi-d.
- Alex