diff --git a/src/com/sun/jna/NativeLibrary.java b/src/com/sun/jna/NativeLibrary.java index 8b4031222b..aafa712d90 100644 --- a/src/com/sun/jna/NativeLibrary.java +++ b/src/com/sun/jna/NativeLibrary.java @@ -124,6 +124,12 @@ private static NativeLibrary loadLibrary(String libraryName, Map options) { } catch(UnsatisfiedLinkError e) { // Add the system paths back for all fallback searching + if (Platform.isMac() && libraryName.contains(".framework/")) { + // Add standard dyld fallback paths + searchPath.add(System.getProperty("user.home")+"/Library/Frameworks/"); + searchPath.add("/Library/Frameworks/"); + searchPath.add("/System/Library/Frameworks/"); + } searchPath.addAll(librarySearchPath); } try { @@ -498,6 +504,10 @@ private static String findLibraryPath(String libName, List searchPath) { private static String mapLibraryName(String libName) { if (Platform.isMac()) { + if (libName.contains(".framework/")) { + // Leave name unchanged if specified as a framework + return libName; + } if (libName.startsWith("lib") && (libName.endsWith(".dylib") || libName.endsWith(".jnilib"))) {