Skip to content

Conversation

@kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Jan 15, 2020

Now that C++/WinRT supports activation extensibility, there's no reason to hook C++/WinRT externs any longer and this brittle practice can stop. To make this more explicit, the externs are renamed to reflect the C++/WinRT convention of using the WINRT_IMPL preamble to mark global functions/macros that are off limits.

@kennykerr kennykerr requested a review from jlaanstra January 16, 2020 21:36
@kennykerr kennykerr merged commit 1e3907d into master Jan 16, 2020
@kennykerr kennykerr deleted the kennykerr-impl branch January 16, 2020 22:17
alvinhochun added a commit to alvinhochun/cppwinrt that referenced this pull request Dec 16, 2022
Weak symbols on mingw-w64 target with GCC and the GNU linker is a bit
broken for the intended use. When using the .weak + .set combo and the
referenced symbol is undefined, LD does not produce an error but instead
treat the referenced symbol like a weak symbol. This can happen if some
of the link library flags is missing. The output executables will crash
on run time.

This change makes the WINRT_IMPL_... symbols into strong aliases, which
means we lose the ability to "hook" these functions when compiling for
mingw-w64 target. But as mentioned in [microsoft#475], developers should stop
doing this anyway.

[microsoft#475]: microsoft#475
alvinhochun added a commit to alvinhochun/cppwinrt that referenced this pull request Dec 17, 2022
Weak symbols on mingw-w64 target with GCC and the GNU linker is a bit
broken for the intended use. When using the .weak + .set combo and the
referenced symbol is undefined, LD does not produce an error but instead
treat the referenced symbol like a weak symbol. This can happen if some
of the link library flags is missing. The output executables will crash
on run time, which can be very confusing.

This change makes the WINRT_IMPL_... Windows API declarations on GNUC
use asm labels instead. This means we lose the ability to "hook" these
functions when compiling for mingw-w64 target. But as mentioned in
[microsoft#475], developers should not be doing this anyway.

[microsoft#475]: microsoft#475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants