RFR: 8346433: Cannot use DllMain in hotspot for static builds [v3]

Magnus Ihse Bursie ihse at openjdk.org
Wed Jan 15 10:41:45 UTC 2025


On Tue, 14 Jan 2025 15:20:48 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Actually, that is kind of the point of this function, so it can be used to look up where it resides.
>
> Oh right, I missed that. 
> 
> But you can just use GetModuleHandle(NULL) then. 
> 
> "If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file)."
> 
> No need to needlessly export a symbol.

Riiiiiight, since this code is now used only for static builds. Otherwise it is a common trick to make this work for both the static and the dynamic case -- you get a reference to either the dll or the entire process. That means I can simplify this a bit.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22793#discussion_r1916328812


More information about the hotspot-runtime-dev mailing list