RFR: 8346388: Cannot use DllMain in libawt for static builds [v4]

Magnus Ihse Bursie ihse at openjdk.org
Mon Jan 20 21:38:35 UTC 2025


On Mon, 20 Jan 2025 17:27:25 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

> I assumed that `JNI_OnLoad` would not be exported correctly if it were not declared with `extern "C"` modifier. At the same time, I see `JNI_OnLoad` in the list of exported functions from `awt.dll` in a recent build of JDK.

Yeah, I dunno. I can't tell if we never run this, and it works anyway, or if we actually do run it despite not being declared `C`. In any case, all other instances of JNI_OnLoad is declared as `C`, so it will certainly not hurt. And, as I said in the comment, when compiling this for static builds it is necessary for the macro to work.

> [JDK-8346306](https://bugs.openjdk.org/browse/JDK-8346306) is the reason why no destructors are modified anymore, is it?

Correct.

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

PR Comment: https://git.openjdk.org/jdk/pull/22790#issuecomment-2603259357
PR Comment: https://git.openjdk.org/jdk/pull/22790#issuecomment-2603259612


More information about the client-libs-dev mailing list