summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-10-05 19:20:21 +0200
committerraysan5 <[email protected]>2021-10-05 19:20:21 +0200
commit7439c7547b5a35f7fba616c8e51a7ca611fbbac7 (patch)
treec63d0e0ffc1b15eea17b75ce5acc2df96af674c1 /src
parentc8b16d72e2008b0d6b61705951b83eff316b71dc (diff)
downloadraylib-7439c7547b5a35f7fba616c8e51a7ca611fbbac7.tar.gz
raylib-7439c7547b5a35f7fba616c8e51a7ca611fbbac7.zip
Review functions specifiers
Diffstat (limited to 'src')
-rw-r--r--src/raymath.h43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/raymath.h b/src/raymath.h
index 4b03b519..795720e1 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -4,6 +4,11 @@
*
* CONFIGURATION:
*
+* #define RAYMATH_IMPLEMENTATION
+* Generates the implementation of the library into the included file.
+* If not defined, the library is in header only mode and can be included in other headers
+* or source files without problems. But only ONE file should hold the implementation.
+*
* #define RAYMATH_STATIC_INLINE
* Define static inline functions code, so #include header suffices for use.
* This may use up lots of memory.
@@ -42,25 +47,35 @@
#ifndef RAYMATH_H
#define RAYMATH_H
-// Function specifiers definition
-#ifndef RMAPI
- #define RMAPI extern inline // Functions defined as 'extern inline' by default
+#if defined(RAYMATH_IMPLEMENTATION) && defined(RAYMATH_STATIC_INLINE)
+ #error "Specifying both RAYMATH_IMPLEMENTATION and RAYMATH_STATIC_INLINE is contradictory"
#endif
-// Function specifiers in case library is build/used as a shared library (Windows)
-// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
-#if defined(_WIN32)
- #if defined(BUILD_LIBTYPE_SHARED)
- #define RMAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll)
- #elif defined(USE_LIBTYPE_SHARED)
- #define RMAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll)
+// Function specifiers definition
+#ifndef RMAPI
+ #if defined(RAYMATH_IMPLEMENTATION)
+ #define RMAPI extern inline // Functions defined as 'extern inline' by default
+
+ // Function specifiers in case library is build/used as a shared library (Windows)
+ // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
+ #if defined(_WIN32)
+ #if defined(BUILD_LIBTYPE_SHARED)
+ #define RMAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll)
+ #elif defined(USE_LIBTYPE_SHARED)
+ #define RMAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll)
+ #endif
+ #endif
+ #elif defined(RAYMATH_STATIC_INLINE)
+ #define RMAPI static inline // Functions may be inlined, no external out-of-line definition
+ #else
+ #if defined(__TINYC__)
+ #define RMAPI static inline // WARNING: Plain inline not supported by tinycc (See issue #435)
+ #else
+ #define RMAPI inline
+ #endif
#endif
#endif
-#if defined(RAYMATH_STATIC_INLINE)
- #define RMAPI static inline // Functions may be inlined, no external out-of-line definition
-#endif
-
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------