I have a native library that I call using JNI. Call to the native library works fine in Linux.
My questions is if I create a .so
and .dll
file for Linux and Windows and add them to the project, is there a way to load the right library based on the operating system my application is running on when calling System.LoadLibrary("myLib")
?
In other words, what would be the right implementation of the pseudo-code below ?
if(Windows){
System.LoadLibrary("myLib.dll");
}else if(Linux){
System.LoadLibrary("myLib.so");
}
Thanks