-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XMGLOBALCONST poorly initialized when used within a cpp modules project #211
Comments
Can you link to how you are building the SimpleMath module? |
It might also be a good idea to open your project in VS, and use |
Not sure if it's what you meant but I am using MSbuild and a VS project. We're using https://github.com/ubisoft/Sharpmake to create our sln and proj files. |
Update : I ended up importing DXMath as source into my project and switching the XMGLOBALCONST to be |
Can you check the code-generation when using |
Also it does not appear there is any standard define to know if its being used in a C++20 module or not. Note you DO NOT have the modify my source. You can use If I were to change the source, I'd probably have to go with (assuming C++20 code gen is not worse with it)
My main concern is that math-heavy code would end up with many copies of the constants instead of just one. |
I've been using directx on a personal project that uses modules and had crashes because some of the XMGLOBALCONST declared constants simply don't have the proper values at runtime. In our case it was specifically g_XMInfinity and g_XMOneHalf (The values were 000). The crashes were caused by asserts failing on XMIsInfinity, among others, due to those.
In our case, we use DXTK and simplemath and import it through a Module partition with the following syntax :
export import <SimpleMath.h>
.It looks like it has something to do with how __declspec(selectany) reacts when used within modules.
Are we right or is there something we are missing?
Thanks!
The text was updated successfully, but these errors were encountered: