use the same style of dll export/import definition and extern c as raylib, so it actually works on windows. (#115)

This commit is contained in:
Jeffery Myers 2020-12-26 10:27:50 -08:00 committed by GitHub
parent f5bd6c08f8
commit 7dae5b06f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,26 +137,19 @@
#endif #endif
// Define functions scope to be used internally (static) or externally (extern) to the module including this file // Define functions scope to be used internally (static) or externally (extern) to the module including this file
#if defined(RAYGUI_STATIC)
#define RAYGUIDEF static // Functions just visible to module including this file
#else
#ifdef __cplusplus
#define RAYGUIDEF extern "C" // Functions visible from other files (no name mangling of functions in C++)
#else
// NOTE: By default any function declared in a C file is extern
#define RAYGUIDEF extern // Functions visible from other files
#endif
#endif
#if defined(_WIN32) #if defined(_WIN32)
#if defined(BUILD_LIBTYPE_SHARED) // Microsoft attibutes to tell compiler that symbols are imported/exported from a .dll
#define RAYGUIDEF __declspec(dllexport) // We are building raygui as a Win32 shared library (.dll). #if !defined(BUILD_LIBTYPE_SHARED)
#define RAYGUIDEF __declspec(dllexport) // We are building raygui as a Win32 shared library (.dll)
#elif defined(USE_LIBTYPE_SHARED) #elif defined(USE_LIBTYPE_SHARED)
#define RAYGUIDEF __declspec(dllimport) // We are using raygui as a Win32 shared library (.dll) #define RAYGUIDEF __declspec(dllimport) // We are using raygui as a Win32 shared library (.dll)
#else
#define RAYGUIDEF // We are building or using raygui as a static library
#endif #endif
#else
#define RAYGUIDEF // We are building or using raygui as a static library (or Linux shared library)
#endif #endif
#if !defined(RAYGUI_MALLOC) && !defined(RAYGUI_CALLOC) && !defined(RAYGUI_FREE) #if !defined(RAYGUI_MALLOC) && !defined(RAYGUI_CALLOC) && !defined(RAYGUI_FREE)
#include <stdlib.h> // Required for: malloc(), calloc(), free() #include <stdlib.h> // Required for: malloc(), calloc(), free()
#endif #endif
@ -181,6 +174,10 @@
#define TEXTEDIT_CURSOR_BLINK_FRAMES 20 // Text edit controls cursor blink timming #define TEXTEDIT_CURSOR_BLINK_FRAMES 20 // Text edit controls cursor blink timming
#if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions
#endif
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
// NOTE: Some types are required for RAYGUI_STANDALONE usage // NOTE: Some types are required for RAYGUI_STANDALONE usage
@ -3716,3 +3713,7 @@ static const char *CodepointToUtf8(int codepoint, int *byteLength)
#endif // RAYGUI_STANDALONE #endif // RAYGUI_STANDALONE
#endif // RAYGUI_IMPLEMENTATION #endif // RAYGUI_IMPLEMENTATION
#if defined(__cplusplus)
} // Prevents name mangling of functions
#endif