diff options
| author | Ahmad Fatoum <ahmad@a3f.at> | 2018-02-22 02:05:00 +0100 |
|---|---|---|
| committer | Ahmad Fatoum <ahmad@a3f.at> | 2018-02-24 15:37:37 +0100 |
| commit | 6ffc8cb7990fb4ff40f205cb53bec797b10e48a2 (patch) | |
| tree | 82a7ac62531aee879891164c478efda6924e2db7 /src/core.c | |
| parent | e4d7bbec1ef08279495ac41f5f8c4be359c58cf0 (diff) | |
| download | raylib-6ffc8cb7990fb4ff40f205cb53bec797b10e48a2.tar.gz raylib-6ffc8cb7990fb4ff40f205cb53bec797b10e48a2.zip | |
raymath.h: Use C99 inline semantics
RAYMATH_EXTERN_INLINE was renamed to RAYMATH_HEADER_ONLY, which user code
may define if they want to use it as header-only library. If multiple
files in the same project define RAYMATH_HEADER_ONLY, they might each
have duplicate out-of-line definitions of the same functions.
By default, raymath.h exposes inline definitions, which instructs the
compiler _not_ to generate out-of-line definitons, if out-of-line
definitions are required, those of the file defined with
RAYLIB_IMPLEMENTATION are used instead. There may be only one such file.
In C++ mode, the compiler will select only one out-of-line definition
automatically, so no need to define a RAYLIB_IMPLEMENTATION.
Unfortunately, we have to remove raymath function declaration from
raylib.h as those declarations would lead to duplicate out-of-line
definitions which would yield linker errors. This problem didn't
exist with GNU89 or C++, because there multiple defintions are ok,
but in C99 they aren't.
Diffstat (limited to 'src/core.c')
| -rw-r--r-- | src/core.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -98,13 +98,12 @@ #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext. #endif +#define RAYMATH_IMPLEMENTATION // Define external out-of-line implementation of raymath here +#include "raymath.h" // Required for: Vector3 and Matrix functions + #include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2 #include "utils.h" // Required for: fopen() Android mapping -#define RAYMATH_IMPLEMENTATION // Use raymath as a header-only library (includes implementation) -#define RAYMATH_EXTERN_INLINE // Compile raymath functions as static inline (remember, it's a compiler hint) -#include "raymath.h" // Required for: Vector3 and Matrix functions - #if defined(SUPPORT_GESTURES_SYSTEM) #define GESTURES_IMPLEMENTATION #include "gestures.h" // Gestures detection functionality |
