RFR: 8346388: Cannot use DllMain in libawt for static builds

Magnus Ihse Bursie ihse at openjdk.org
Wed Dec 18 19:55:36 UTC 2024


On Wed, 18 Dec 2024 19:35:09 GMT, Phil Race <prr at openjdk.org> wrote:

> DllMain is a default name, not a required name. You could just rename them and add /entry to the linker command line, eg /entry:AwtDllMain

That was an interesting piece of information I did not know. That could be used to resolve issue 2. However, it does not resolve issue 1, which is that this code must be called somehow for static libraries nevertheless.

> I do read your comment about not knowing when the static destructors are called vs the DllMain on shutdown, but surely this _is_ well defined ?

That is possible. It could be just that I have failed to locate the documentation about this. I did find about the static initializer fiasco, and I have studied when JNI_OnUnload happens (answer: basically it doesn't), and what I have found about DllMain has not been very specific, so I'm not too hopeful that it is indeed well defined.

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

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


More information about the client-libs-dev mailing list