[foreign] NPE when trying to lookup a symbol in the default library when no libraries are loaded

Jorn Vernee jbvernee at xs4all.nl
Wed Sep 12 18:25:04 UTC 2018

Sundararajan Athijegannathan schreef op 2018-09-12 20:08:
> I don't think it is jshell vs. compiled java program. It must be
> something else - because simplest main code does not reproduce NPE for
> me.
> import java.foreign.*;
> public class Main {
>   public static void main(String[] args) throws Exception {
>      Libraries.getDefaultLibrary().lookup("");
>   }
> }
> java Main
> Exception in thread "main" java.lang.NoSuchMethodException: Cannot
> find symbol  in library <default>
>     at
> java.base/java.lang.ClassLoader$NativeLibrary.lookup(ClassLoader.java:2428)
>     at Main.main(Main.java:5)

Ok, then I don't know. Btw, I am using the latest panama build minus the 
last 2 change sets from today, but also with Maurizio's callbacks RFR 
applied [1] (It might that then?).

> fwiw, the "default library" is a pseudo Library that searches all
> symbols in the process.

Ok good to know! I thought as much, but couldn't find where the 
libraries were being searched in the source code. I'm just finding a 
call to dlsym or GetProcAddress for the call to NativeLibrary.findEntry 
. Is the defaultLibrary field being patched over by the VM? Can you 
point me in the right direction?


> -Sundar

[1] : 

More information about the panama-dev mailing list