[foreign-memaccess+abi] RFR: 8266814: Improve library loading with SymbolLookup abstraction [v2]
Jorn Vernee
jvernee at openjdk.java.net
Mon May 10 16:22:28 UTC 2021
On Mon, 10 May 2021 15:48:28 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/SystemLookup.java line 46:
>>
>>> 44: case SysV, AArch64 -> NativeLibraries.rawNativeLibraries(SystemLookup.class, false).loadLibrary("syslookup");
>>> 45: case Win64 -> NativeLibraries.rawNativeLibraries(SystemLookup.class, false)
>>> 46: .loadLibrary(Path.of(System.getenv("SystemRoot"), "System32", "msvcrt.dll").toString());
>>
>> Looks like this loadLibrary call does not except paths:
>>
>>
>> assert name.indexOf(File.separatorChar) < 0;
>>
>>
>> So this is causing an assertion error on Windows. I'll try to find a fix.
>
> That's a bug - we should use `System::load` with a full path
This patch fixes the problem:
Suggestion:
.loadLibrary(null, Path.of(System.getenv("SystemRoot"), "System32", "msvcrt.dll").toFile());
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/531
More information about the panama-dev
mailing list