RFR: 8282191: Implementation of Foreign Function & Memory API (Preview) [v37]

Mandy Chung mchung at openjdk.java.net
Thu May 5 16:26:37 UTC 2022


On Wed, 4 May 2022 23:44:08 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Another option would be to treat calls to `ensureNativeAccess` with `null` caller class as coming from unnamed module.
>
> Looking deeper, `System::loadLibrary` seems to search the boot loader libraries when invoked with a `null` caller class, so replicating that behavior should be safe.

`BootLoader` is what you want in this case - it defines the static methods to access resources, packages etc defined to the boot loader (aka null `ClassLoader`).

To find a symbol defined in the native libraries loaded by the boot loader, you can call `BootLoader.getNativeLibraries().find(name)`.

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

PR: https://git.openjdk.java.net/jdk/pull/7888



More information about the build-dev mailing list