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 ([email protected])
4 * @brief ArkScript configuration macros
5 * @date 2020-10-27
6 *
7 * @copyright Copyright (c) 2020-2025
8 *
9 */
10
11#ifndef INCLUDE_ARK_PLATFORM_HPP
12#define INCLUDE_ARK_PLATFORM_HPP
13
14#if defined(_WIN32) || defined(_WIN64)
15# define ARK_OS_WINDOWS
16#else // Linux, FreeBSD, Mac OS X
17# define ARK_OS_LINUX
18#endif
19
20#ifndef ARK_STATIC
21# ifdef ARK_OS_WINDOWS
22// Windows compilers need specific (and different) keywords for export and import
23# ifdef ARK_EXPORT
24# define ARK_API __declspec(dllexport)
25# else
26# define ARK_API __declspec(dllimport)
27# endif
28
29// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
30# ifdef _MSC_VER
31# pragma warning(disable : 4251)
32# endif
33# else
34# if __GNUC__ >= 4
35// GCC 4 has special keywords for showing/hiding symbols,
36// the same keyword is used for both importing and exporting
37# define ARK_API __attribute__((__visibility__("default")))
38# else
39// GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
40# define ARK_API
41# endif
42# endif
43#else
44# define ARK_API
45#endif
46
47#ifdef ARK_OS_WINDOWS
48# define ARK_API_INLINE ARK_API
49#else
50# define ARK_API_INLINE ARK_API inline
51#endif
52
53#endif