ArkScript
A small, fast, functional and scripting language for video games
Platform.hpp
Go to the documentation of this file.
1 /**
2  * @file Platform.hpp
3  * @author Alexandre Plateau (lexplt.dev@gmail.com)
4  * @brief ArkScript configuration macros
5  * @version 0.2
6  * @date 2020-10-27
7  *
8  * @copyright Copyright (c) 2020-2021
9  *
10  */
11 
12 #ifndef INCLUDE_ARK_PLATFORM_HPP
13 #define INCLUDE_ARK_PLATFORM_HPP
14 
15 #if defined(_WIN32) || defined(_WIN64)
16 # define ARK_OS_WINDOWS
17 #else // Linux, FreeBSD, Mac OS X
18 # define ARK_OS_LINUX
19 #endif
20 
21 #ifndef ARK_STATIC
22 # ifdef ARK_OS_WINDOWS
23 // Windows compilers need specific (and different) keywords for export and import
24 # ifdef ARK_EXPORT
25 # define ARK_API __declspec(dllexport)
26 # else
27 # define ARK_API __declspec(dllimport)
28 # endif
29 
30 // For Visual C++ compilers, we also need to turn off this annoying C4251 warning
31 # ifdef _MSC_VER
32 # pragma warning(disable : 4251)
33 # endif
34 # else
35 # if __GNUC__ >= 4
36 // GCC 4 has special keywords for showing/hidding symbols,
37 // the same keyword is used for both importing and exporting
38 # define ARK_API __attribute__((__visibility__("default")))
39 # else
40 // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
41 # define ARK_API
42 # endif
43 # endif
44 #else
45 # define ARK_API
46 #endif
47 
48 #ifdef ARK_OS_WINDOWS
49 # define ARK_API_INLINE ARK_API
50 #else
51 # define ARK_API_INLINE ARK_API inline
52 #endif
53 
54 #endif