This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: dynamic_cast problem in JNI code - any suggestions welcome.
- From: Tom Tromey <tromey at redhat dot com>
- To: Jan Hardenbergh <hardenbergh at rtviz dot com>
- Cc: "'Andrew Haley'" <aph at redhat dot com>, "'java at gcc dot gnu dot org'" <java at gcc dot gnu dot org>
- Date: 12 Nov 2002 09:49:45 -0700
- Subject: Re: dynamic_cast problem in JNI code - any suggestions welcome.
- References: <5DB40C9911DDD61190CF00D0B78867BE014140@claven.rtviz.com>
- Reply-to: tromey at redhat dot com
>>>>> "Jan" == Jan Hardenbergh <hardenbergh@rtviz.com> writes:
Jan> NOTE! this code runs FINE when used in another application. The
Jan> exact same shared object dies when run from Java thru JNI.
I gather you're using Sun's Java. This list is really only for
discussion of gcj and related things.
Jan> Another thing I have noticed is that there are unresolved
Jan> references in our library that do not seem to get called,
Jan> however, when the library is opened in the JNI environment, it
Jan> wants all symbols resolved.
Jan> This seems to support the theory that some library involved in
Jan> dynamic linking is not compiled with the same compiler.
Jan> This crash does not happen if static_cast is used in place of
Jan> dynamic_cast.
libstdc++ has runtime support for dynamic_cast<> in it. And, you must
use the libstdc++ corresponding to the compiler that you used to
compile your application -- you can't mix-and-match.
Also libgcc may play a role here. Perhaps linking your shared library
against the correct versions of libgcc and libstdc++ will help. I'm
not really certain.
If you continue to have problems with this, I suggest moving them to
the libstdc++ or gcc lists. But most likely this issue has come up
before and been discussed -- try searching the list archives.
Tom