What is best practice to call `SymbolLookup.libraryLookup()` in cross-platform way?

Lev Serebryakov lev at blacklion.dev
Fri Jan 30 12:18:06 UTC 2026


January 29, 2026 at 5:39 PM, "Daniel Lemire" <daniel at lemire.me> wrote:


> Maybe.,..
> 
> System.loadLibrary("mylib");
> 

 As far as I can tell java.lang.foreign doesn't use `System.loadLibrary()` and one cannot be converted to another.

  Documentation in JDK says it is `dlopen()` for POSIX-like and `LoadLibrary()` for Windows (which is pity, as they requires very different arguments). But I cannot make it work on MacOS even with `dlopen()` rules.

  And I don't want to use full paths, as they are very OS-specific...


-- 
// Lev Serebryakov


More information about the panama-dev mailing list