Lunchbox  1.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
os.h
1 
2 /* Copyright (c) 2005-2014, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
19 #ifndef LUNCHBOX_OS_H
20 #define LUNCHBOX_OS_H
21 
22 #include <lunchbox/api.h>
23 #include <lunchbox/defines.h>
24 #include <lunchbox/compiler.h>
25 
26 #ifdef _WIN32
27 # ifndef WIN32
28 # define WIN32
29 # endif
30 # ifndef WIN32_API
31 # define WIN32_API
32 # endif
33 # ifndef _MSC_VER
34 # define USE_SYS_TYPES_FD_SET
35 # endif
36 # ifndef _WIN32_WINNT // Hopefully to higher than 0x500...
37 # define _WIN32_WINNT 0x501 // => XP, for WM_XBUTTONDOWN and others
38 # endif
39 # ifndef _USE_MATH_DEFINES
40 # define _USE_MATH_DEFINES
41 # endif
42 # ifndef WIN32_LEAN_AND_MEAN
43 # define WIN32_LEAN_AND_MEAN
44 # endif
45 # ifndef NOMINMAX
46 # define NOMINMAX
47 # endif
48 # include <winsock2.h>
49 # include <windows.h>
50 # include <windef.h>
51 #endif
52 
53 #include <cmath>
54 #include <cstdio>
55 #include <cstdlib>
56 #include <string>
57 
58 #ifndef _MSC_VER
59 # include <stdint.h>
60 # include <sys/param.h> // for MIN/MAX
61 # include <strings.h>
62 #endif
63 
64 #ifdef __APPLE__
65 # include <crt_externs.h>
66 # define environ (*_NSGetEnviron())
67 #elif !defined(_WIN32)
68 extern "C" char **environ;
69 #endif
70 
71 namespace lunchbox
72 {
74 static inline void setZero( void* ptr, const size_t size )
75 {
76 #ifdef _WIN32
77  ::memset( ptr, 0, size );
78 #else
79  ::bzero( ptr, size );
80 #endif
81 }
82 
84 LUNCHBOX_API std::string getHostname();
85 }
86 
87 #endif //LUNCHBOX_OS_H
Defines export visibility macros for Lunchbox.
LUNCHBOX_API std::string getHostname()