OSGeo/PROJ-JNI

native library naming.

harideva16 opened this issue · 2 comments

Java native interface (jni) allows calling native libraries

  1. Windows --> .dll,
  2. Linux --> .so and
  3. Mac -->.dylib.

I use the following code to load native library.

  static {
    System.loadLibrary("mypl");
    }

If I generate native library in windows os the native library's name comes mypl.dll

But , in Linux os the native library's name comes libmypl.so and in mac it comes libmypl.dylib

Will this code System.loadLibrary("mypl"); load native library correcty after creating JPackage in linux and mac ?

This sounds like a very generic problem, why is not relevant at the PROJ-JNI issue tracker?

Hello @harideva16. Indeed this is a generic Java question not specific to PROJ-JNI. Yes, the library name (mypl in above example) will be translated to the platform-specific name (mypl.dll, libmypl.so or libmypl.dylib) automatically by the Java environment. However it may not be sufficient for allowing Java to find it. It depends also on other factors such as environment variables which control in which directory the system will search for the library.