Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNA: The specified procedure could not be found

 
Nathan Barraille
Greenhorn
Posts: 6
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I was trying to learn how JNA works, so I decided to use the spotify API (libspotify 0.0.7). I managed to load my dll correctly, but then it looks like my code is not finding any of the method defined in the API:



I'm running Windows 7 x86 and I'm running my code in Eclipse.


Here is my code:

Main class


My Library wrapping interface:



Here is the declaration of the method I'm trying to call




The domain classes:




Do you have any idea of what's happening? Do you see any problem with my code?

Thank you!!!

nbarraille
 
Nathan Barraille
Greenhorn
Posts: 6
Chrome Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally found the solution by opening the libspotify.dll with Dependency Walker: The compiler added some extra information to the method name (a underscore prefix and a @4 or @8 suffix).

I had to:

- Create an implementation of FunctionMapper that renamed all my methods according to the real names (available in Dependency Walker)
- Instantiate my Library with an instance of this mapper in the options map.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic