rust-windowing / glutin

A low-level library for OpenGL context creation
Apache License 2.0
2k stars 477 forks source link

Fixed crash in `EglGetProcAddress` on Win32-x86 platform #1688

Closed varphone closed 2 months ago

varphone commented 2 months ago

Summary

Change the calling convention of the EglGetProcAddress declaration to extern "system" to automatically use the correct calling convention for the platform.

Details

The EglGetProcAddress function uses the stdcall calling convention on the Win32-x86 platform, but it was previously declared as extern "C" in the code.

On the Win32-x86 platform, extern "C" functions use the cdecl calling convention by default.

This mismatch in calling conventions caused a crash.

By changing the declaration to extern "system", the correct calling convention for the platform will be used automatically, preventing the crash.

Testing

varphone commented 2 months ago

Could you add a changelog entry for that? should be fine after that.

Already added, please review again.

MarijnS95 commented 2 months ago

In general I'm not a fan of "Fixed crash" or other context-less titles using the word "fix", can we come up with anything more descriptive (i.e. "use the correct calling convention for EglGetProcAddress() on Win32-x86 (optionally: preventing a crash)")? Same for the PR title.

Probably not a requirement to merge though, depending on what Kirill thinks of this.