-dlopen self
Erik Poupaert
erik.poupaert@chello.be
Wed Mar 19 10:12:00 GMT 2003
The example works -- with gcc. But not with gcj. I don't know, am I doing
something wrong?
Starting from TestJNI.java with its native method myNative():
$gcj -C TestJNI.java
$gcjh -jni TestJNI
$gcjh -jni -stubs TestJNI
it produced TestJNI.h and the empty TestJNI.c file.
I filled in the empty stub to do something when invoked, modified the
include directives, and added the function parameter names. Then I compiled
the whole lot and linked it together into one executable.
$ gcc -c TestJNI.c -o jni-c-part.o
$ gcj -c -fjni TestJNI.java -o jni-java-part.o
$ gcj -export-dynamic --main=TestJNI jni-c-part.o jni-java-part.o -o testjni
$ ./testjni
nothing (should be saying "Hello from jni")
When I do this with SWT, the jni symbol resolver even fails to find the
native symbols. On windows, it works, though, by linking with the *.exp
file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestJNI.java
Type: java/*
Size: 159 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030319/e3f68c9e/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: TestJNI.h
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030319/e3f68c9e/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: TestJNI.c
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030319/e3f68c9e/attachment.c>
More information about the Java
mailing list