Skip to content

Conversation

@fsb4000
Copy link
Contributor

@fsb4000 fsb4000 commented Sep 8, 2021

Fixes #990

@fsb4000 fsb4000 requested a review from a team as a code owner September 8, 2021 14:02
@StephanTLavavej StephanTLavavej added the bug Something isn't working label Sep 8, 2021
@StephanTLavavej
Copy link
Member

After looking at this, I agree that the change is correct and ABI-safe.

Usually, anything mentioning _CRTIMP2_IMPORT affects ABI. However, your analysis is correct - these are guarded by #if !_HAS_EXCEPTIONS and we never build the STL's DLL in that mode (with the exception of stl/src/raisehan.cpp but that doesn't drag in <typeinfo>), so they never expand to __declspec(dllexport). Thus the macros should be removed, so that they never expand to __declspec(dllimport) for user code.

I have verified this by inspecting the DLL's exports (these types don't appear), and by performing an internal build of the STL with

#if !_HAS_EXCEPTIONS

#if defined(CRTDLL2) && defined(_CRTBLD)
#error WOOF
#endif

// ...

here; it succeeded, proving that these are indeed never exported.

@StephanTLavavej StephanTLavavej self-assigned this Jun 1, 2022
@StephanTLavavej
Copy link
Member

I'm (speculatively) mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 79bf997 into microsoft:main Jun 2, 2022
@StephanTLavavej
Copy link
Member

Thanks for fixing this long-standing bug! 😻 🐞 🎉

@fsb4000 fsb4000 deleted the fix990 branch June 2, 2022 04:10
fsb4000 added a commit to fsb4000/STL that referenced this pull request Aug 13, 2022
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<any>: std::any doesn't link when exceptions are disabled

3 participants