Static linking with JNI-Libs possible?

Ranjit Mathew
Wed Apr 16 04:53:00 GMT 2003

> So is it possible to link everything except of the "other dynamic 
> libraries" into one single executable (with static libgcj) ?
> Is this also possible with the mingw32-build?

Yes, Erik has done this before. IIRC, he compiled SWT into a 
static library, omitting the calls to System.loadLibrary( ...)
and making sure that all SWT symbols are properly exported
either via an explicit "exports" file or (better) with the
latest MinGW binutils snapshot that allows EXEs to export
symbols (binutils-2.13.90-20030111):

Even after this, you *might* have to ask the linker to
search the libraries repeatedly to resolve circular
dependencies by using this with gcj in the final
command to link everything:

-Wl,--start-group <all-swt-libraries-here> -Wl,--end-group

Erik is the guru of this voodoo here, so if I've
missed out something he should be able to point it out.


More information about the Java mailing list