RFR: 7903597: Slim down RuntimeHelper
Jorn Vernee
jvernee at openjdk.org
Mon Dec 4 13:48:13 UTC 2023
On Fri, 1 Dec 2023 22:31:46 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 248:
>>
>>> 246: }
>>> 247:
>>> 248: void emitLoadLibraries(List<String> libraries) {
>>
>> To be fair, moving forward I'm not too convinced about keeping this section. That is, perhaps it would be better to give up trying to use static jextract options to configure which library is loaded at runtime, and use a loader lookup. The client code can then side-effect the classloader by making sure the correct library is loaded.
>
> Right, I was thinking of dropping it, but I've kept it for now, since we also fall back to the default lookup, and I'm not sure how important that is.
What I don't like about the side-effect approach is that there is an implicit ordering dependency with the order in which load(Library) is class and when the lib needs to be loaded when we try to call a function. I feel like we're too much at the whims of when the JVM decides to load which class there. At least with the current approach, the loadLibrary call and the references to the symbol are in the same class, so the library _has_ to be loaded before the symbol is referenced.
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/150#discussion_r1413893008
More information about the jextract-dev
mailing list