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

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Sep 12 20:49:19 UTC 2018


Yeah - was just about to write that.

I think currently we rely on RTLD_DEFAULT which is available in mac and 
linux. But I don't think it's very portable and I've read too that it 
doesn't work too well with Windows.

I think a more robust alternative would be to always explicitly denote 
the library name - as JNR does. For instance, if you want the standard C 
lib, just loadLibray("c"). E.g. remove the getDefaultLibrary() method 
from the API.

Maurizio




On 12/09/18 19:31, Jorn Vernee wrote:
>> 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?
>
> Never mind I found it :)
>
> void* getDefaultHandle() {
>     // FIXME: This is not yet tested on Windows.
>     return getProcessHandle();
> }
>
> Jorn



More information about the panama-dev mailing list