• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

UnsatisfiedLinkError -- Missing underscore in _Java prefix?

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Uh oh, we're definitely being carded. Here, show him this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic