ArkScript
A small, lisp-inspired, functional scripting language
Platform.hpp
Go to the documentation of this file.
1/**
2 * @file Platform.hpp
3 * @author Lexy Plateau (lexplt.dev@gmail.com)
4 * @brief ArkScript configuration macros
5 * @date 2020-10-27
6 *
7 * @copyright Copyright (c) 2020-2026
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 FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
21# if defined(__GNUC__) || defined(__clang__)
22# define ARK_ALWAYS_INLINE __attribute__((always_inline))
23# elif defined(_MSC_VER) && !defined(__clang__)
24# define ARK_ALWAYS_INLINE __forceinline
25# endif
26#else
27# define ARK_ALWAYS_INLINE
28#endif
29
30#ifndef ARK_STATIC
31# ifdef ARK_OS_WINDOWS
32// Windows compilers need specific (and different) keywords for export and import
33# ifdef ARK_EXPORT
34# define ARK_API __declspec(dllexport)
35# else
36# define ARK_API __declspec(dllimport)
37# endif
38
39// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
40# ifdef _MSC_VER
41# pragma warning(disable : 4251)
42# endif
43# else
44# if __GNUC__ >= 4
45// GCC 4 has special keywords for showing/hiding symbols,
46// the same keyword is used for both importing and exporting
47# define ARK_API __attribute__((__visibility__("default")))
48# else
49// GCC < 4 has no mechanism to explicitly hide symbols, everything's exported
50# define ARK_API
51# endif
52# endif
53#else
54# define ARK_API
55#endif
56
57#ifdef ARK_OS_WINDOWS
58# define ARK_API_INLINE ARK_API
59#else
60# define ARK_API_INLINE ARK_API inline
61#endif
62
63#endif