Crash in JNI test application

João Garcia jgarcia@uk2.net
Mon Jan 19 19:22:00 GMT 2004


Øyvind Harboe wrote:

 >My JNI superpowers are rather limited and I haven't tested it against
 >Sun's JRE, but the application is simple and is a subset of all the
 >JNI helloworld apps out there.
 >
Do you really need something so complicated?
Do you have to use the main() in C?

Unless you have some objective that I am missing, you could simply use
a main() in Java!

I would use CNI (unless I was to use the code also with a standard JVM
in which case I would place the C code into a dll and would use JNI).

A CNI example follows (JNI would be almost the same, with changed
function calls and header). The CNI header is created from the
HelloWorld.class by using:
gcjh HelloWorld

To build, please use:
gcj -c HelloWorld.java
gcj -c Hello.cpp
gcj --main=HelloWorld -o HelloWorld.exe HelloWorld.o Hello.o


João


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: HelloWorld.java
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040119/bb09960c/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: HelloWorld.h
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040119/bb09960c/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Hello.cpp
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040119/bb09960c/attachment-0001.ksh>


More information about the Java mailing list