#pragma once // Reference: https://stackoverflow.com/questions/2164827/explicitly-exporting-shared-library-functions-in-linux // Generate macro for import and export respectively. #if defined(_MSC_VER) // Microsoft #define BS_RAW_EXPORT __declspec(dllexport) #define BS_RAW_IMPORT __declspec(dllimport) #elif defined(__GNUC__) // GCC #define BS_RAW_EXPORT __attribute__((visibility("default"))) #define BS_RAW_IMPORT #elif defined(__clang__) // Clang #define BS_RAW_EXPORT __attribute__((visibility("default"))) #define BS_RAW_IMPORT #else // Do nothing and hope for the best? #define BS_RAW_EXPORT #define BS_RAW_IMPORT #error "Unknown dynamic link import/export semantics." #endif // Choosee import or export command according to special macro. #if defined(BS_EXPORTING) #define BS_NAKED_EXPORT BS_RAW_EXPORT #else #define BS_NAKED_EXPORT BS_RAW_IMPORT #endif // Create real export macro according to whether in C++ environment. #if defined(__cplusplus) #define BS_EXPORT extern "C" BS_NAKED_EXPORT #else #define BS_EXPORT BS_NAKED_EXPORT #endif