Skip to content

Commit

Permalink
use the same style of dll export/import definition and extern c as ra…
Browse files Browse the repository at this point in the history
…ylib, so it actually works on windows. (#115)
  • Loading branch information
JeffM2501 authored Dec 26, 2020
1 parent f5bd6c0 commit 7dae5b0
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/raygui.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,26 +137,19 @@
#endif

// 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(BUILD_LIBTYPE_SHARED)
#define RAYGUIDEF __declspec(dllexport) // We are building raygui as a Win32 shared library (.dll).
// Microsoft attibutes to tell compiler that symbols are imported/exported from a .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)
#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
#else
#define RAYGUIDEF // We are building or using raygui as a static library (or Linux shared library)
#endif


#if !defined(RAYGUI_MALLOC) && !defined(RAYGUI_CALLOC) && !defined(RAYGUI_FREE)
#include <stdlib.h> // Required for: malloc(), calloc(), free()
#endif
Expand All @@ -181,6 +174,10 @@

#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
// NOTE: Some types are required for RAYGUI_STANDALONE usage
Expand Down Expand Up @@ -3716,3 +3713,7 @@ static const char *CodepointToUtf8(int codepoint, int *byteLength)
#endif // RAYGUI_STANDALONE

#endif // RAYGUI_IMPLEMENTATION

#if defined(__cplusplus)
} // Prevents name mangling of functions
#endif

0 comments on commit 7dae5b0

Please sign in to comment.