From 2250d047c00ee1baa602bb8fcb9531ebcce89c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Bl=C3=A4sing?= Date: Tue, 14 Jun 2022 21:18:02 +0200 Subject: [PATCH] Fix name mapping difference between AIX JDK 8 and Semeru JDK 18 AIX JDK mapped dynamic libraries to ".a", while Semeru maps dynamic libraries to ".so". This change unifies this to ".a". --- src/com/sun/jna/NativeLibrary.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/sun/jna/NativeLibrary.java b/src/com/sun/jna/NativeLibrary.java index c68e773d1d..73e5139a8a 100644 --- a/src/com/sun/jna/NativeLibrary.java +++ b/src/com/sun/jna/NativeLibrary.java @@ -781,7 +781,8 @@ else if (Platform.isLinux() || Platform.isFreeBSD()) { } } else if (Platform.isAIX()) { // can be libx.a, libx.a(shr.o), libx.so - if (libName.startsWith("lib")) { + if (isVersionedName(libName) || libName.endsWith(".so") || libName.startsWith("lib") || libName.endsWith(".a")) { + // A specific version was requested - use as is for search return libName; } } @@ -791,7 +792,12 @@ else if (Platform.isWindows()) { } } - return System.mapLibraryName(libName); + String mappedName = System.mapLibraryName(libName); + if(Platform.isAIX() && mappedName.endsWith(".so")) { + return mappedName.replaceAll(".so$", ".a"); + } else { + return mappedName; + } } private static boolean isVersionedName(String name) {