Static linking of C-Libs with CNI possible?

Erik Poupaert erik.poupaert@chello.be
Sat Feb 15 13:27:00 GMT 2003



>>> You said you can link swt statically. Does that mean your binary
>>> contains the Java-Code, the Java-JNI-Part and the C-Lib (.dll) ?

Indeed, my executable is fully self-contained. It does not reference
anything outside its own symbols (and the win32 platform/system dlls). So, I
do not deploy any dll.

>>>> Hmm, I simply need to generate such a .defs file and then compile  with
>>>> that file? Hmm..
>>>> In those articles there was used a tool calles "dlltool" to generate
the
>>>> .defs-files, does such a tool also exist for Linux?

Well, that's a bit of a win32 thing. What you need to do is to make sure
your executable exports the symbols of its statically linked libraries; or
at least, the ones that contain jni symbols.

I just link the ".exp" file. I don't know how you can add symbols to export
in an executable in Linux. I'm confident it is possible, because otherwise
the natRuntime.cc code wouldn't make any sense; and it was written before
gcj could run on Windows.

Does anybody else know how you do this on Linux?



More information about the Java mailing list