On Mon, 20 Jan 2025 21:47:33 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>> Actually, this function needs to be **not** static for it to work -- it uses >> it's own address to look up the handle that contains it -- which will be >> awt.dll when running a normal, dynamic build, and the entire java.exe when >> running a static build. > > Yep. A static function could be optimised out… inlined. However, if the > address of the function is taken, the function should remain as a stand-alone > callable function. Adding `static` shouldn't remove the function, it just > ensures the function name isn't visible to other .obj files. > > I'm not 100% sure, yet I think it should work correctly even when > `GetAwtModuleHandle` is declared `static`. You are 100% correct. It works fine with static. I got kind of confused that name resolution should come into play, but I guess Windows just looks up the address and determines what module it belongs to that way. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22790#discussion_r1925410792