Did you explicitly intend to use matchLibrary in this context in order
to match libraries with a version suffix?
On Jul 19, 2008, at 2:05 PM, Filippo Carone wrote:
Hi people,
I'm attaching a patch for the Native loadLibrary method. Basically,
after the first load failure, retries adding the "lib" prefix to the
specified library. This is a concrete case for VideoLAN (I'm the
author of the videolan java bindings with JNA). What do you think
about it?
Cheers,
Filippo
Index: jnalib/src/com/sun/jna/NativeLibrary.java
===================================================================
--- jnalib/src/com/sun/jna/NativeLibrary.java (revisione 620)
+++ jnalib/src/com/sun/jna/NativeLibrary.java (copia locale)
@@ -110,6 +110,12 @@
catch(UnsatisfiedLinkError e2) { e = e2; }
}
}
+ else if (Platform.isWindows()) {
+ libraryName = "lib" + libraryName;
+ libraryPath = matchLibrary(libraryName, searchPath);
+ try { handle = open(libraryPath); }
+ catch(UnsatisfiedLinkError e2) { e = e2; }
+ }
if (handle == 0) {
throw new UnsatisfiedLinkError("Unable to load
library '" + libraryName + "': "
+ e.getMessage());