Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

UnsatisfiedLinkError -- Missing underscore in _Java prefix?  RSS feed

 
John Kelty
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm getting the familiar JNI error UnsatisfiedLinkError. In my particular case, the code works fine on Linux, but I get that dreaded error on Windows. I suspect its something to do with the build options. I'm using MinGW to build.

I compile with options like this:
g++ -ggdb -c -U_WIN32 -D_JNI_IMPLEMENTATION_ -Wall TestUtilities.cpp

and link like this:
g++ -shared -D_JNI_IMPLEMENTATION_ -Wl --kill-at --add-stdcall-alias -o JNI_API.dll TestUtilities.o Manager.o -lstdc++ -lws2_32

Finally, a DLL export viewer shows my function names beginning with "Java_", but I believe when I used to build this under VisualStudio, the names began with "_Java".

Any ideas?
 
John Kelty
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it seems like this may have been a stumper. I found a hack around it, by defining this macro:



and using it like this:



--John
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!