2 * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport
4 * Origin : Zdenek Nemec - zero@mapfactor.com
5 * Michael Fink - vividos@users.sourceforge.net
11 #define _STLP_COMPILER "eMbedded Visual C++"
13 // This flag is being used by STLport to support
14 // old-fashioned Windows CE SDK (see stl_wince.h)
15 // do not use with eMebedded Visual C++ 3 or 4!
20 /* Compiler dependent define. The following defines may be available:
21 * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3
22 * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET
23 * _STLP_WCE always defined when compiling with one of the above
28 #if (_WIN32_WCE > 300)
29 # define _STLP_WCE_NET UNDER_CE
30 #elif (_WIN32_WCE == 300)
31 # define _STLP_WCE_EVC3 UNDER_CE
33 # error No support for Windows CE below 3.0!
36 // This is defined for all platforms using Windows CE
39 /* All Windows CE versions up to at least version 5 are little-endian, even
40 * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */
41 #define _STLP_LITTLE_ENDIAN
43 // Ensure _DEBUG is defined.
44 #if defined (DEBUG) && !defined (_DEBUG)
48 // in evc3/4, on ARM, check that _STLP_DEBUG is not defined
49 // the ARM compiler has a bug that prevents that debug mode from working
50 #if _WIN32_WCE < 500 && defined(ARM) && defined(_STLP_DEBUG)
51 # error _STLP_DEBUG mode is not supported in evc3 and evc4 on the ARM platform!
54 // inherit all msvc6 options
55 #include <stl/config/_msvc.h>
57 // CE up to at least version 5 has no C locale support
58 #define _STLP_NO_LOCALE_SUPPORT
60 #if _WIN32_WCE >= 0x500
61 // SDKs built with PB5 have terminate&co in namespace std...
62 # define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD
63 # define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD
64 // ...and new_handler/set_new_handler in the global namespace.
65 # define _STLP_GLOBAL_NEW_HANDLER 1
68 // Always threaded in eMbedded Visual C++ 3.0 and .NET
73 // we don't have a static native runtime library
74 #undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
77 // no long double under CE3 and older
78 # define _STLP_NO_LONG_DOUBLE
81 // no *f and *l math functions available
82 #define _STLP_NO_VENDOR_MATH_F
83 #define _STLP_NO_VENDOR_MATH_L
86 * Redirect cout, cerr and clog:
87 * If defined redirect cout, cerr and clog to
88 * files stdout.txt, stderr.txt and stdlog.txt
90 //# define _STLP_REDIRECT_STDSTREAMS
93 * Static class members may generate LNK1179:
94 * Wrong COMDAT packing may cause LNK1179 error.
95 * For details see http://groups.google.com/groups?th=8a05c82c4ffee280
96 * example P78. This define is not used/needed at this moment
97 * but may came handy in future...
99 //# define _STLP_STATIC_MEMBERS_BUG
101 // Use wide-string interface of windows native functions (CreateFile...).
102 // Note that this should be defined all the time while under CE.
103 #if defined (UNICODE)
104 # define _STLP_USE_WIDE_INTERFACE
107 // Force exception std to std instead of __std_alias.
108 #if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES)
109 # ifdef _STLP_VENDOR_EXCEPT_STD
110 # undef _STLP_VENDOR_EXCEPT_STD
112 # define _STLP_VENDOR_EXCEPT_STD std
115 // short string optimization bug under evc3, evc4 using ARM compiler
116 #if _MSC_VER<1400 && (defined (ARM) || defined (_ARM_))
117 # define _STLP_DONT_USE_SHORT_STRING_OPTIM
120 // when using MFC, disable another placement new declaration, since there is one in wcealt.h
121 #if !defined (__BUILDING_STLPORT) && defined (_MFC_VER)
122 # define __PLACEMENT_NEW_INLINE
130 // Use old fashioned headers (ctime vs. time.h).
131 #undef _STLP_NO_NEW_C_HEADERS
132 #define _STLP_NO_NEW_C_HEADERS
134 // exception handling support: only on evc4 and user added /GX to project settings
135 #if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND)
136 # define _STLP_NO_EXCEPTION_HEADER
137 # define _STLP_NO_EXCEPTIONS
138 # undef _STLP_USE_EXCEPTIONS
139 # ifndef __THROW_BAD_ALLOC
140 # define __THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); }
144 #define _STLP_WINCE_TRACE(msg) OutputDebugString(msg)
147 * eMbedded Visual C++ .NET specific settings
149 #if defined (_STLP_WCE_NET)
151 // evc4 has no locale and time support
152 # define _STLP_NO_LOCALE_SUPPORT
153 # define _STLP_NO_TIME_SUPPORT
155 // ptrdiff_t is not defined in evc4 headers
156 # ifndef _PTRDIFF_T_DEFINED
157 typedef int ptrdiff_t;
158 # define _PTRDIFF_T_DEFINED
162 * Helper macros for including the native headers in cases where a file with
163 * the same name also exists in the STLport include folder. The idea behind
164 * this is that we first go up one directory and then down into a dir that
165 * is only present in the native install but not in STLport.
168 # if !defined (_STLP_NATIVE_INCLUDE_PATH)
170 # if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR)
171 # define _STLP_NATIVE_INCLUDE_PATH ../Emulator
173 # define _STLP_NATIVE_INCLUDE_PATH ../X86
175 # elif defined (_ARM_)
179 # define _STLP_NATIVE_INCLUDE_PATH ../Armv4
180 # elif defined (ARMV4I)
181 # define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
182 # elif defined (ARMV4T)
183 # define _STLP_NATIVE_INCLUDE_PATH ../Armv4t
185 # error Unknown ARM SDK.
188 // VC8 crosscompiling for CE
190 # define _STLP_NATIVE_INCLUDE_PATH ../Armv4
191 # elif defined(ARMV4I) || defined(ARMV4T)
192 # define _STLP_NATIVE_INCLUDE_PATH ../Armv4i
194 # error Unknown ARM SDK.
197 # elif defined (_MIPS_)
198 # if defined (MIPS16)
199 # define _STLP_NATIVE_INCLUDE_PATH ../mips16
200 # elif defined (MIPSII)
201 # define _STLP_NATIVE_INCLUDE_PATH ../mipsII
202 # elif defined (MIPSII_FP)
203 # define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp
204 # elif defined (MIPSIV)
205 # define _STLP_NATIVE_INCLUDE_PATH ../mipsIV
206 # elif defined (MIPSIV_FP)
207 # define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp
209 # error Unknown MIPS SDK.
213 # define _STLP_NATIVE_INCLUDE_PATH ../sh3
215 # define _STLP_NATIVE_INCLUDE_PATH ../sh4
217 # error Unknown SHx SDK.
222 # endif /* !_STLP_NATIVE_INCLUDE_PATH */
224 /* Workaround when using MFCCE and using <new> together: MFCCE's wcealt.h doesn't
225 * check for __PLACEMENT_NEW_INLINE before defining operator new, so when <new>
226 * defines the operatore before, there will be an error C2084:
227 * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body".
229 # ifdef _STLP_USE_MFC
230 # define __PLACEMENT_NEW_INLINE
233 #endif /* _STLP_WCE_NET */
235 /* Workaround in _windows.h needs native headers access macros
237 #include <stl/config/_native_headers.h>
240 * eMbedded Visual C++ 3.0 specific settings
242 #if defined (_STLP_WCE_EVC3)
244 # define _STLP_NO_NATIVE_MBSTATE_T
246 // evc3 has no locale and time support
247 # define _STLP_NO_LOCALE_SUPPORT
248 # define _STLP_NO_TIME_SUPPORT
250 // evc3 has new, but no explicit header
251 # define _STLP_NO_NEW_HEADER
252 # define _STLP_NO_NEW_NEW_HEADER
254 // evc3 has no bad_alloc and no typeinfo
255 # undef _STLP_NO_BAD_ALLOC
256 # define _STLP_NO_BAD_ALLOC
258 # undef _STLP_NO_TYPEINFO
259 # define _STLP_NO_TYPEINFO
261 // missing things in eMbedded Visual C++ 3.0 headers
262 # ifndef _SIZE_T_DEFINED
263 typedef unsigned int size_t;
264 # define _SIZE_T_DEFINED
267 # ifndef _WCHAR_T_DEFINED
268 typedef unsigned short wchar_t;
269 # define _WCHAR_T_DEFINED
272 // ptrdiff_t is not defined in evc3 headers
273 # ifndef _PTRDIFF_T_DEFINED
274 typedef int ptrdiff_t;
275 # define _PTRDIFF_T_DEFINED
278 // clock_t is not defined in evc3 headers
279 # ifndef _CLOCK_T_DEFINED
280 typedef long clock_t;
281 # define _CLOCK_T_DEFINED
284 // Struct tm is not defined in evc3 headers
287 int tm_sec; /* seconds after the minute - [0,59] */
288 int tm_min; /* minutes after the hour - [0,59] */
289 int tm_hour; /* hours since midnight - [0,23] */
290 int tm_mday; /* day of the month - [1,31] */
291 int tm_mon; /* months since January - [0,11] */
292 int tm_year; /* years since 1900 */
293 int tm_wday; /* days since Sunday - [0,6] */
294 int tm_yday; /* days since January 1 - [0,365] */
295 int tm_isdst; /* daylight savings time flag */
300 // define placement new and delete operator
301 // note: when MFCCE headers are included first, don't define the new operator,
302 // since it was already defined in wcealt.h
304 # ifndef __PLACEMENT_NEW_INLINE
306 inline void *__cdecl operator new(size_t, void *_P) { return (_P); }
307 # endif /* _MFC_VER */
308 inline void __cdecl operator delete(void *, void *) { return; }
309 # define __PLACEMENT_NEW_INLINE
311 # endif /* __cplusplus */
313 // evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove
314 # define _STLP_NO_NATIVE_WIDE_FUNCTIONS
316 // evc3 doesn't have assert.h
317 # ifndef _ASSERT_DEFINED
318 # define assert(expr) _STLP_ASSERT(expr)
319 # define _ASSERT_DEFINED
322 #endif /* _STLP_WCE_EVC3 */
324 // Minimize windows.h includes
325 #if !defined (WIN32_LEAN_AND_MEAN)
326 # define WIN32_LEAN_AND_MEAN
328 #if !defined (VC_EXTRALEAN)
329 # define VC_EXTRALEAN
331 #if !defined (STRICT)
335 // Don't let windows.h define its min and max macros.
336 #if !defined (NOMINMAX)
341 * original call: TerminateProcess(GetCurrentProcess(), 0);
342 * we substitute the GetCurrentProcess() with the result of the inline function
343 * defined in kfuncs.h, since we then can avoid including <windows.h> at all.
344 * all needed Win32 API functions are defined in <stl/_windows.h>
346 #ifndef _ABORT_DEFINED
347 # define _STLP_ABORT() TerminateProcess(reinterpret_cast<HANDLE>(66), 0)
348 # define _ABORT_DEFINED
351 // Notice: windows.h isn't included here anymore; all needed defines are in
352 // stl/_windows.h now
354 #endif /* _STLP_EVC_H */