very questionable code

This commit is contained in:
rusefillc 2024-01-12 22:36:30 -05:00
parent 5bfc8e4c4c
commit 8370f2a253
2 changed files with 23 additions and 15 deletions

View File

@ -0,0 +1,6 @@
package peak.can.basic;
public class HackLoadLibraryFlag {
// control if library should be auto-loaded or not
public static boolean LOAD_LIBRARY = true;
}

View File

@ -325,11 +325,13 @@ public class PCANBasic {
public native boolean initializeAPI();
static {
try {
System.loadLibrary("pcanbasic_jni");
} catch (UnsatisfiedLinkError e) {
System.out.println(e.getMessage());
System.loadLibrary("PCANBasic_JNI");
if (HackLoadLibraryFlag.LOAD_LIBRARY) {
try {
System.loadLibrary("pcanbasic_jni");
} catch (UnsatisfiedLinkError e) {
System.out.println(e.getMessage());
System.loadLibrary("PCANBasic_JNI");
}
}
}
}