Static linking of JNI code - HOW?

Jost Boekemeier JBoekemeier@inetsoftware.de
Mon Jun 16 16:23:00 GMT 2003


> We are creating an application with GCJ and we wish to statically link
> our JNI code to bypass the whole shared library mess.  I have been able
> to statically link in my JNI code, but the runtime is still looking for
> the code in a lib


You need put the jni functions into jni hashtable (with RegisterNatives).
For example if you have the two functions ImageDecoderPixbuf_initState and
scanImage and you want to register them, you can use the following code
(natcStartup.c, natcStartup.h) attached.

As usual your Startup.java has to be compiled with -fjni.


Jost

-------------- next part --------------
A non-text attachment was scrubbed...
Name: natcStartup.c
Type: application/octet-stream
Size: 3241 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030616/1c254e56/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: natcStartup.h
Type: application/octet-stream
Size: 446 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030616/1c254e56/attachment-0001.obj>


More information about the Java mailing list