7 messages in net.java.dev.jna.usersRe: [jna-users] patch: windows load l...
FromSent OnAttachments
Filippo CaroneJul 19, 2008 11:05 am.diff
Timothy WallJul 27, 2008 8:11 pm 
Filippo CaroneJul 28, 2008 5:34 am 
Wayne MeissnerJul 28, 2008 8:25 am 
Filippo CaroneJul 28, 2008 10:07 am 
Timothy WallJul 28, 2008 2:30 pm 
Filippo CaroneJul 30, 2008 3:34 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] patch: windows load library 2nd tryActions...
From:Timothy Wall (twal@dev.java.net)
Date:Jul 28, 2008 2:30:36 pm
List:net.java.dev.jna.users

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());