1 // File: Standard_Macro.hxx
2 // Copyright: Open Cascade 2007
3 // Purpose: This file is intended to be the first file #included to any
4 // Open CASCADE source. It defines platform-specific pre-processor
5 // macros necessary for correct compilation of Open CASCADE code
7 #ifndef _Standard_Macro_HeaderFile
8 # define _Standard_Macro_HeaderFile
12 #endif /* HAVE_CONFIG_H */
14 // Standard OCC macros: Handle(), STANDARD_TYPE()
15 # define Handle(ClassName) Handle_##ClassName
16 # define STANDARD_TYPE(aType) aType##_Type_()
18 //======================================================
19 // Windows-specific definitions
20 //======================================================
22 // check if WNT macro is not defined but compiler is MSVC
23 #if defined(_MSC_VER) && !defined(WNT)
24 #error "Wrong compiler options has been detected. Add /DWNT option for proper compilation!!!!!"
27 # if defined(WNT) && !defined(HAVE_NO_DLL)
29 # ifndef Standard_EXPORT
30 # define Standard_EXPORT __declspec( dllexport )
31 // For global variables :
32 # define Standard_EXPORTEXTERN __declspec( dllexport ) extern
33 # define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport )
34 # endif /* Standard_EXPORT */
36 # ifndef Standard_IMPORT
37 # define Standard_IMPORT __declspec( dllimport ) extern
38 # define Standard_IMPORTC extern "C" __declspec( dllimport )
39 # endif /* Standard_IMPORT */
41 // We must be careful including windows.h: it is really poisonous stuff!
42 // The most annoying are #defines of many identifiers that you could use in
43 // normal code without knowing that Windows has its own knowledge of them...
44 // So lets protect ourselves by switching OFF as much as possible of this in advance.
45 // If someone needs more from windows.h, he is encouraged to #undef these symbols
46 // or include windows.h prior to any OCCT stuff.
47 // Note that we define each symbol to itself, so that it still can be used
48 // e.g. as name of variable, method etc.
49 #ifndef WIN32_LEAN_AND_MEAN
50 #define WIN32_LEAN_AND_MEAN /* exclude extra Windows stuff */
53 #define NOMINMAX NOMINMAX /* avoid #define min() and max() */
56 #define NOMSG NOMSG /* avoid #define SendMessage etc. */
59 #define NODRAWTEXT NODRAWTEXT /* avoid #define DrawText etc. */
62 #define NONLS NONLS /* avoid #define CompareString etc. */
65 #define NOGDI NOGDI /* avoid #define SetPrinter (winspool.h) etc. */
68 #define NOSERVICE NOSERVICE
71 #define NOKERNEL NOKERNEL
85 //======================================================
87 //======================================================
89 # ifndef Standard_EXPORT
90 # define Standard_EXPORT
91 // For global variables :
92 # define Standard_EXPORTEXTERN extern
93 # define Standard_EXPORTEXTERNC extern "C"
94 # endif /* Standard_EXPORT */
96 # ifndef Standard_IMPORT
97 # define Standard_IMPORT extern
98 # define Standard_IMPORTC extern "C"
99 # endif /* Standard_IMPORT */
101 // Compatibility with old SUN compilers
103 // This preprocessor directive is a kludge to get around
104 // a bug in the Sun Workshop 5.0 compiler, it keeps the
105 // /usr/include/memory.h file from being #included
106 // with an incompatible extern "C" definition of memchr
107 // October 18, 2000 <rboehne@ricardo-us.com>
108 #if __SUNPRO_CC_COMPAT == 5
114 //======================================================
116 //======================================================
118 # ifndef __Standard_API
120 # if !defined(WNT) || defined(__Standard_DLL) || defined(__FSD_DLL) || defined(__MMgt_DLL) || defined(__OSD_DLL) || defined(__Plugin_DLL) || defined(__Quantity_DLL) || defined(__Resource_DLL) || defined(__SortTools_DLL) || defined(__StdFail_DLL) || defined(__Storage_DLL) || defined(__TColStd_DLL) || defined(__TCollection_DLL) || defined(__TShort_DLL) || defined(__Units_DLL) || defined(__UnitsAPI_DLL) || defined(__Dico_DLL)
121 # define __Standard_API Standard_EXPORT
122 # define __Standard_APIEXTERN Standard_EXPORTEXTERN
124 # define __Standard_API Standard_IMPORT
125 # define __Standard_APIEXTERN Standard_IMPORT
126 # endif // __Standard_DLL
128 //# define __Standard_API
130 # endif // __Standard_API
132 // Define _OCC64 variable (unless already defined) if platform is known to be 64-bit
134 #if defined (__alpha) || defined(DECOSF1) || defined(_WIN64) || defined(__amd64) || defined(__x86_64)