Thursday, September 04, 2008

JNA win64 port

JNA now supports 64-bit windows. The the build is a bit nonstandard, but it's automatic and reproducible. I was hoping to use mingw-64, but that project is not yet sufficient for JNA's purposes. Fortunately, the MS has a free 64-bit cross compiler which does work.

Thanks to the fine folks at Aquafold (actually mostly Niels G. the CTO) for making it possible.

Thanks also to T. Heller of python's ctypes for the initial glue bits.

5 comments:

Johannes Schindelin said...

I managed to use ming-w64 without problems (well, it's only compile-tested so far). This is my procedure on Linux-amd64:

- first compile libffi by configuring it with --host=x86_64-pc-mingw32 (this requires the cross compiler of ming-w64 for Linux-amd64, of course),

- compile jnidispatch.rc with windres,

- then copy the javah'ed sources and the Java includes (I think I use the OpenJDK ones, with a custom jni_md.h for other reasons) and libs/libffi.a into jnilib/native and compile dispatch.c and callback.c.

- link everything with -shared and you're done.

Works (compiling, at least, don't have $$$ to waste on M$ so I cannot test).

Johannes Schindelin said...

Oh, completely forgot: if you need help reproducing, just mail me.

technomage said...

Unfortunately, compiling's not the problem. The mingw64 build fails a good portion of the unit tests when run.

BorisBrodski said...

Give it a try one more time. The last release of MinGW-w64 builds correct dlls on Windows XP 64.

I was able to build 7-Zip-JBinding (http://sevenzipjbind.sourceforge.net/) on Win64 and all 3100 tests were green.

technomage said...

@BorisBrodski: I know, I supplied the libffi win64 port for gcc :)

I'm keeping the VC build in JNA because it provides structured exception handling, which gcc at this point does not. However, it *is* possible to build JNA with mingw64 by tweaking one or two lines in the Makefile.