Static linking with JNI-Libs possible?

Erik Poupaert erik.poupaert@chello.be
Wed Apr 16 12:36:00 GMT 2003


>>>>> Does that mean I can link the library which is wraped (e.g. libXm.a)
the
>>>>> c-part of the bindings (swt.so) and the java part into one axecutable,
>>>>> the only thing I have to do is to compile the .a-Files with the
options
>>>>> --whole-archive and -export-dynamic?

The --whole-archive only needs to surround the c-part. For the java part
it's not needed.

>>>> gcj -O2 libXm.a swt-native.a swt-java.a MyApp.java --main=MyApp -o
Test1
>>>> --whole-archive --export-dynamic

I use simple expressions that Ant resolves through variable substitution.
Fully resolved, such expression looks more like:

gcj -O2 -Xlinker --start-group libXm.a -Wl,--whole-archive
swt-native.a -Wl,--no-whole-archive swt-java.a -Xlinker --end-group
MyApp.java --main=MyApp -o Test1 -export-dynamic

>>>>> In fact I dont want to use SWT, its for another library....

It should still apply -- mutatis mutandis.

Furthermore, I guess the --whole-archive option is not needed when you use
CNI, because CNI symbols are not resolved dynamically through ltdl, but are
resolved using the C++ ABI instead (is this correct?).



More information about the Java mailing list