Skip to content
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

Standard_Macro.hxx conflicts on Windows defines #145

Open
dpasukhi opened this issue Nov 4, 2024 · 0 comments
Open

Standard_Macro.hxx conflicts on Windows defines #145

dpasukhi opened this issue Nov 4, 2024 · 0 comments
Labels
1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code 2. Bug Something isn't working

Comments

@dpasukhi
Copy link
Member

dpasukhi commented Nov 4, 2024

Category

Foundation Classes

Severity

Major

Description

windows.h and #defines in Standard_Macro.hxx

Report: https://dev.opencascade.org/content/windowsh-and-defines-standardmacrohxx

We ran into a compiler error due to a conflict with Open CASCADE headers and another 3rd party component's headers. Specifically the following code in Standard_Macro.hxx caused issues in the other library until I commented these lines out. Can this be moved out of a Standard header in a future release?

// We must be careful including windows.h: it is really poisonous stuff!
// The most annoying are #defines of many identifiers that you could use in
// normal code without knowing that Windows has its own knowledge of them...
// So lets protect ourselves by switching OFF as much as possible of this in advance.
// If someone needs more from windows.h, he is encouraged to #undef these symbols
// or include windows.h prior to any OCCT stuff.
// Note that we define each symbol to itself, so that it still can be used
// e.g. as name of variable, method etc.
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN /* exclude extra Windows stuff */
#endif
#ifndef NOMINMAX
#define NOMINMAX NOMINMAX /* avoid #define min() and max() */
#endif
#ifndef NOMSG
#define NOMSG NOMSG /* avoid #define SendMessage etc. */
#endif
#ifndef NODRAWTEXT
#define NODRAWTEXT NODRAWTEXT /* avoid #define DrawText etc. */
#endif
#ifndef NONLS
#define NONLS NONLS /* avoid #define CompareString etc. */
#endif
#ifndef NOGDI
#define NOGDI NOGDI /* avoid #define SetPrinter (winspool.h) etc. */
#endif
#ifndef NOSERVICE
#define NOSERVICE NOSERVICE
#endif
#ifndef NOKERNEL
#define NOKERNEL NOKERNEL
#endif
#ifndef NOUSER
#define NOUSER NOUSER
#endif
#ifndef NOMCX
#define NOMCX NOMCX
#endif
#ifndef NOIME
#define NOIME NOIME
#endif

Expected Behavior

Standard_Macro.hxx Have no conflict definition for external usage.

Actual Behavior

Standard_Macro.hxx had windows macro redefitions

Sample Code or DRAW Tcl Script

None

Operating System

Windows

Compiler

MSVC

Compiler Version

No response

Bitness

64-bit

OCCT Version

7.8

Precise OCCT Version or Branch

No response

Environment

No response

Additional Files

https://dev.opencascade.org/content/windowsh-and-defines-standardmacrohxx

@dpasukhi dpasukhi added 2. Bug Something isn't working 1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code 2. Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant