0

I am trying to load a sharedobject library via JNA

the file is called libLIBNAME.so my code looks like this:

Native.loadLibrary("LIBNAME", SomeInterface.class);

but everytime i execute it, i get

Unable to load library 'LIBNAME': dlopen(libLIBNAME.dylib, 9): image not found

how do i tell JNA to load xxx.so instead of xxx.dylib?

I have also tried wrapping the .so-file inside a .dylib by just passing the arguments, but apparently with no luck

setting a symlink from libLIBNAME.so to libLIBNAME.dylib results in:

Unable to load library 'LIBNAME': dlopen(/path..../libLIBNAME.dylib, 9): no suitable image found. Did find: /path..../libLIBNAME.dylib: unknown file type, first eight bytes: 0x62 0x6F 0x6F 0x6B 0x00 0x00 0x00 0x00

any ideas?

Wolf
  • 991
  • 1
  • 9
  • 12
  • JNA will also load whatever file you indicate if you provide the full name of the file instead of just the library name. – technomage May 15 '12 at 11:55

1 Answers1

0

As the name would suggest, Native.loadLibrary() needs a library that's native to the platform that it's running on -- a library that was compiled for another platform is not suitable. I'm not sure what kind of file your library file is, but the first few bytes being reported by dyld (62 6f 6f 6b = "book"?) indicate that it is definitely not a Mac OS X dylib.

  • lipo -info libLIBNAME.so generates: Architectures in the fat file: libLIBNAME.so are: ppc i386 ppc64 x86_64 – Wolf May 13 '12 at 12:42