[foreign-memaccess+abi] RFR: 8266814: Improve library loading with SymbolLookup abstraction [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon May 10 15:54:35 UTC 2021


On Mon, 10 May 2021 15:36:01 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/SymbolLookup.java
>>   
>>   Co-authored-by: Jorn Vernee <JornVernee at users.noreply.github.com>
>
> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/SystemLookup.java line 45:
> 
>> 43:     final NativeLibrary syslookup = switch (CABI.current()) {
>> 44:         case SysV, AArch64 -> NativeLibraries.rawNativeLibraries(SystemLookup.class, false).loadLibrary("syslookup");
>> 45:         case Win64 -> NativeLibraries.rawNativeLibraries(SystemLookup.class, false)
> 
> e.g. a short comment here that explains why Windows is different.

I'll add a comment here

> 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

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/531


More information about the panama-dev mailing list