This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCJ .jar to .so with native method
- From: Joe Hoffert <jhoffert at dre dot vanderbilt dot edu>
- To: Andrew Haley <aph at redhat dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 09 Jan 2008 09:43:41 -0600
- Subject: Re: GCJ .jar to .so with native method
- References: <1196774413.3986.18.camel@sirion.dre.vanderbilt.edu> <18261.21978.841368.32225@zebedee.pink> <1196777200.3362.11.camel@sirion.dre.vanderbilt.edu> <18261.28465.895232.916931@zebedee.pink> <1196782972.3362.22.camel@sirion.dre.vanderbilt.edu> <18261.31076.962649.532047@zebedee.pink> <1196786104.3362.47.camel@sirion.dre.vanderbilt.edu> <18261.33673.40725.493124@zebedee.pink> <1196790426.3362.60.camel@sirion.dre.vanderbilt.edu> <18261.39111.838608.411440@zebedee.pink> <1196795057.3362.83.camel@sirion.dre.vanderbilt.edu> <18262.31707.635908.772089@zebedee.pink> <1329.129.59.82.132.1196873567.squirrel@www.dre.vanderbilt.edu> <18262.57520.523884.357898@zebedee.pink> <18262.58112.56736.735559@zebedee.pink>
Hi, Andrew.
You had helped me very much last month trying to integrate Java and C++
using gcj/gcjh. I've run into problems (both using the gcj/gcjh .so
approach and the Java Invocation API approach). I can present details
about the specific problems but I'm wondering if you knew of problems in
general with generating a Java library using JDK 1.5 and then using
that .jar file with g++/gcj 4.1.2.
I needed to use both JDK and gcj since the Java source code uses
generics which gcj won't compile and I'm using g++ for my C++ compiler.
I had problems loading and calling the Java library using JDK 1.6 and g
++/gcj and then switched to compiling with JDK 1.5. This got me to my
present situation of segmentation errors showing up.
I'm suspecting the mixing of JDK and g++/gcj as a problem area because
of the problems I saw using JDK 1.6 and also because of the following. I
have C++ code that uses the Java Invocation API to load the Java library
and make calls into it. The Java library also has a native method that
calls back into C (and then C++).
However, I get strange segmentation errors from the JVM with the C++
code that is called back from the Java library. I have the C++ code
running in its own thread (spawned after the native method is invoked)
with the stack trace from the JVM crash showing all C/C++ code. I am
puzzled why the JVM would crash with a call stack like this. That's why
I'm suspecting a larger problem of JDK and g++/gcj not working well
together. Do you have experience with these types of problems?
I can provide more detail if that's helpful but I want to see if someone
else knows of problems mixing JDK 1.5 and g++/gcj 4.1.2 before I spend
any more time looking into this. Do you know of problems mixing JDK and
gcj?
Thank you very much for all your help!
-Joe