mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-27 13:36:12 +01:00
Added checks for __cplusplus so that CSFML can be used in C++.
This commit is contained in:
1 parent
848b4d3aaa
commit
29382a4492
1 file changed
+13
-3
+13
-3
@@ -33,6 +33,16 @@
|
|||||||
#define CSFML_VERSION_MINOR 1
|
#define CSFML_VERSION_MINOR 1
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Check if we need to mark functions as extern "C"
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define CSFML_EXTERN_C extern "C"
|
||||||
|
#else
|
||||||
|
#define CSFML_EXTERN_C extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Identify the operating system
|
// Identify the operating system
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -71,7 +81,7 @@
|
|||||||
|
|
||||||
// Windows compilers need specific (and different) keywords for export and import
|
// Windows compilers need specific (and different) keywords for export and import
|
||||||
#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
|
#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
|
||||||
#define CSFML_API_IMPORT extern __declspec(dllimport)
|
#define CSFML_API_IMPORT CSFML_EXTERN_C __declspec(dllimport)
|
||||||
|
|
||||||
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
|
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -87,13 +97,13 @@
|
|||||||
// GCC 4 has special keywords for showing/hidding symbols,
|
// GCC 4 has special keywords for showing/hidding symbols,
|
||||||
// the same keyword is used for both importing and exporting
|
// the same keyword is used for both importing and exporting
|
||||||
#define CSFML_API_EXPORT extern "C" __attribute__ ((__visibility__ ("default")))
|
#define CSFML_API_EXPORT extern "C" __attribute__ ((__visibility__ ("default")))
|
||||||
#define CSFML_API_IMPORT extern __attribute__ ((__visibility__ ("default")))
|
#define CSFML_API_IMPORT CSFML_EXTERN_C __attribute__ ((__visibility__ ("default")))
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
|
// GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
|
||||||
#define CSFML_API_EXPORT extern "C"
|
#define CSFML_API_EXPORT extern "C"
|
||||||
#define CSFML_API_IMPORT extern
|
#define CSFML_API_IMPORT CSFML_EXTERN_C
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user