OSGeo / PROJ-JNI

Java Native Interface for PROJ
https://osgeo.github.io/PROJ-JNI/
MIT License
23 stars 15 forks source link

native library naming. #49

Closed harideva16 closed 3 years ago

harideva16 commented 3 years ago

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 ?

kbevers commented 3 years ago

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

desruisseaux commented 3 years ago

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.