• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

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
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic