RFR: 8346377: Properly support static builds for Windows [v2]
Magnus Ihse Bursie
ihse at openjdk.org
Fri Dec 20 13:11:22 UTC 2024
On Thu, 19 Dec 2024 21:52:10 GMT, Phil Race <prr at openjdk.org> wrote:
>> Magnus Ihse Bursie has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix comment
>
> src/java.desktop/windows/native/libawt/windows/awt_Mlib.cpp line 53:
>
>> 51: */
>> 52: if (JVM_IsStaticallyLinked()) {
>> 53: hDLL = ::GetModuleHandle(NULL);
>
> So this returns a handle to the process instead ?
> I suppose this exists for apps that want the process, not for apps that can't get a handle to a DLL.
> I am not sure if this is always sufficiently equivalent to work for whatever the app needs it for .. I hope this doesn't create downstream problems that we need to fix.
`hDLL` is a static variable scoped inside `hDLL`, so it easy to see all places it is used in. They are all about doing `GetProcAddress` for the exported functions in `mlib_image`. This is following a pattern from how we've handled static/dynamic duality elsewhere in the JDK. What we're really after in the `hDLL` variable is getting a handle to something that can look up e.g. "j2d_mlib_ImageCreate". For a dynamic build, that is a DLL, but for a static build, it is the executable.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22795#discussion_r1893918833
More information about the build-dev
mailing list