RFR: 8346388: Cannot use DllMain in libawt for static builds
Julian Waters
jwaters at openjdk.org
Thu Dec 19 06:48:35 UTC 2024
On Wed, 18 Dec 2024 19:53:10 GMT, Magnus Ihse Bursie <ihse 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.
That would not be the correct solution to issue 2. Contrary to popular belief DllMain is _not_ the first piece of code that is called for a dll (That is, it is not the actual dll entry point), that would be DllMainCRTStartup (Or something similar, I forgot the exact name). -entry changes the default name of the initial loader from DllMainCRTStartup to whatever you specified, NOT the DllMain initialization function. Using -entry in this way would royally break AWT and make it non-functional. If that doesn't happen, it would mean we are monumentally lucky, but it would likely still not work properly
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22790#issuecomment-2552911127
More information about the client-libs-dev
mailing list