-
Notifications
You must be signed in to change notification settings - Fork 138
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
Create a compiler flag to disable the definition of I #191
Comments
Here are some example compiler errors for reference:
And:
|
Thanks for checking. I am not inclined to accept this since it feels a bit strange. Maybe there are other workarounds? |
That def should probably be disabled for c++. |
And while the standard says it can be undef by the program, including it in math.h without complex.h is likely problematic. |
I did not notice that it was being included in
The other option for a workaround is to have my |
This approach did resolve the issue with the STL:
|
The stars have re-aligned and this is failing for me once again when compiling libcpp with openlibm. This appears to be tied to x86_64 specifically. The reason is that openlibm_fenv.h includes "math_private.h", which exposes openlibm_complex.h. Nominally this is to have a definition of OLM_DLLEXPORT:
This is defined originally in openlibm_math.h using the same values:
Testing locally, I can resolve the compilation error if I replace the math_include.h header with the OLM_DLLEXPORT definition. The library builds successfully. I will submit a PR that eliminates the macro duplication and decouples the openlibm_fenv_amd64.h header from math_private.h. |
When using this library with C++, there are apparently conflicts with some of the template functions. People are using "I" in C++ headers, which gets substituted with the
_Complex_I
macro. (It's truly a great mystery as to why the particular headers I'm using even includecmath
, but I'll leave that for another project).The easiest solution that I can think would be to have a compile-time switch that could disable the definition of
I
. In my initial sanity check, everything seems to compile/link fine - I build openlibm withI
defined, and then remove the definition for my C++ project's build.Before I head further down that route (with a potential PR), I wanted to know whether you foresee any difficulties arising from using this library in C++ with
I
undefined (or if you'd accept such a change at all).The text was updated successfully, but these errors were encountered: