RFR: 8355080: java.base/jdk.internal.foreign.SystemLookup.find() doesn't work on static JDK [v3]

Jorn Vernee jvernee at openjdk.org
Mon Apr 28 13:07:46 UTC 2025


On Mon, 28 Apr 2025 08:30:43 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> Having to upgrade to JNI is a bit sad -- although I get that it is required as a workaround for now. For the longer term I'd prefer a better way to integrate static lookups in the FFM API. For instance, all `JNI::loadLibrary` does when it comes to static libraries is to return the so called "process handle" -- e.g. a handle to the running process (the JVM). If there was a way to retrieve such a handle (e.g. via a dedicated `SymbolLookup` factory) it would be possible to avoid the JNI dance: just get the process symbol lookup, and look for statically linked symbols in there.

I remember this wasn't quite as elegant on Windows, but I suppose there is already some solution in place to look up symbols that are statically linked into the same executable?

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

PR Comment: https://git.openjdk.org/jdk/pull/24801#issuecomment-2835178681


More information about the core-libs-dev mailing list