Last active
August 30, 2017 03:47
-
-
Save garrettsickles/f769ef42de3732f84a9ff10d8f044824 to your computer and use it in GitHub Desktop.
Cross Platform API Declaration (C, C++)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --------------------------------------------------------------- // | |
// Need To Know | |
// _MSC_VER: Microsoft C/C++ Compiler | |
// DLL_EXPORT: Defined when compiling to a DLL (DynamicLibrary) | |
// STATIC_EXPORT: Defined when compiling to a LIB (StaticLibrary) | |
// --------------------------------------------------------------- // | |
// Microsoft C/C++ Compiler (MSVC) | |
#if defined(_MSC_VER) | |
#if defined(DLL_EXPORT) | |
// Compiling to DynamicLibrary (DLL) | |
#define API __declspec(dllexport) | |
#else | |
// Otherwise... | |
#define API | |
#endif | |
// If we are non MSVC (Export by default) | |
#else | |
#define API | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment