This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

JNI Link Errors

Hi there.  I've been hunting through the archives of the Internet for a few 
hours now looking for what I can do to make it possible for a C++ program to 
invoke the Java JNI.  I have some sample code that should work, but when I 
compile with gcc 2.95.3-5 (from Cygwin), I get undefined references, 

c++ -o invoke.exe invoke.o  -L. -ljvm  --demangle
invoke.o: In function `main':
//u/projects/jnitest2/invoke.c:26: undefined reference to 
//u/projects/jnitest2/invoke.c:34: undefined reference to 
collect2: ld returned 1 exit status
make: *** [invoke.exe] Error 1

On a different system, the "mangled" functions did not have the _imp__ 
prefix, but that system had similar errors....I believe it may have 
something to do with the way GCC mangles function calls (thus my attempt at 
using the --demangle option), but I'm not sure how to fix it to work with 
JNI.  If anyone has a solution out there, I'd like to hear it.  Thanks.
- Joe Clark

PS -- If you could send a direct response that would be great, as I am not 
currently on this mailing list.

Get your FREE download of MSN Explorer at

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]