Static linking with JNI-Libs possible?

Ranjit Mathew rmathew4lists@hotmail.com
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):

http://prdownloads.sourceforge.net/mingw/binutils-2.13.90-20030111-1.tar.gz

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.

Ranjit.



More information about the Java mailing list