From e67ebabb02c1068d6e7f5107dcff5388ede3faa5 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 23 Apr 2019 14:55:35 +0200 Subject: Support custom memory management macros Users can define their custom memory management macros. NOTE: Most external libraries support custom macros in the same way, raylib should redefine those macros to raylib ones, to unify custom memory loading. That redefinition is only implemented as example for stb_image.h in [textures] module. --- src/raylib.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 424a9dd7..43260e06 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -99,6 +99,17 @@ // Shader and material limits #define MAX_SHADER_LOCATIONS 32 // Maximum number of predefined locations stored in shader struct #define MAX_MATERIAL_MAPS 12 // Maximum number of texture maps stored in shader struct + +// Allow custom memory allocators +#ifndef RL_MALLOC + #define RL_MALLOC(sz) malloc(sz) +#endif +#ifndef RL_CALLOC + #define RL_CALLOC(n,sz) calloc(n,sz) +#endif +#ifndef RL_FREE + #define RL_FREE(p) free(p) +#endif // NOTE: MSC C++ compiler does not support compound literals (C99 feature) // Plain structures in C++ (without constructors) can be initialized from { } initializers. -- cgit v1.2.3