This is the mail archive of the gcc@gcc.gnu.org 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, 
specifically:

c++ -o invoke.exe invoke.o  -L. -ljvm  --demangle
invoke.o: In function `main':
//u/projects/jnitest2/invoke.c:26: undefined reference to 
`_imp__JNI_GetDefaultJavaVMInitArgs@4'
//u/projects/jnitest2/invoke.c:34: undefined reference to 
`_imp__JNI_CreateJavaVM@12'
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 http://explorer.msn.com/intl.asp


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