Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcore_desktop_glfw.c] fix: make sure that GLFW uses RL_*ALLOC macros #4777

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

sleeptightAnsiC
Copy link
Contributor

@sleeptightAnsiC sleeptightAnsiC commented Feb 18, 2025

Raylib allows for providing custom allocators via macros. GLFW supports this too, but via function pointers. Let's make sure that GLFW uses those Raylib macros, by wrapping them in function calls and setting them up inside of InitPlatform(). This is possible because of glfwInitAllocator() and GLFWallocator. (see linked issue for more context)

I hope that code notes speak for itself but let me know what do you think, and if this is the correct approach or not.

Tested on x86_64 Linux with GNU Make and Cmake, with GCC and TCC, by compiling and running some examples.

Reference: https://www.glfw.org/docs/latest/intro_guide.html#init_allocator
Fixes: #4776
Relates-to: #4751

Raylib allows for providing custom allocators via macros.
GLFW supports this too, but via function pointers.

Make sure that GLFW uses those Raylib macros, by wrapping them in
function calls and setting them up inside of InitPlatform().
This is possible because of glfwInitAllocator() and GLFWallocator.

Fixes: raysan5#4776
Relates-to: raysan5#4751
@sleeptightAnsiC sleeptightAnsiC changed the title [rcore_desktop_glfw.c] fix: make sure that GLFW uses RL_*alloc macros [rcore_desktop_glfw.c] fix: make sure that GLFW uses RL_*ALLOC macros Feb 18, 2025
@raysan5 raysan5 merged commit 77df0ab into raysan5:master Feb 18, 2025
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Feb 18, 2025

@sleeptightAnsiC thanks for this review! That TODO has been there for a long time! 👍😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[rcore] GLFW does not use Raylib-provided RL_*ALLOC macros for memory allocations
2 participants