Skip to content

Conversation

sakgoyal
Copy link

@sakgoyal sakgoyal commented Oct 3, 2025

Allow C++ compilers to compile this code without separately linking as a C library.

Changes:

  • Backport RGFW unicode fix
  • Add C-style casting
  • Fix a initializer list being in the wrong order (C++ requires declaration order)
  • GLFW currently has issues with cross compiling so I am using RGFW for now
  • Change C Aggregate initializer to C++ default initializer.
  • Remove duplicate key in keyMappingRGFW
clang++ -static --std=c++23 -D PLATFORM_DESKTOP_RGFW -D _CRT_SECURE_NO_WARNINGS \
.\src\main.cpp .\vendor\raylib\src\raudio.c .\vendor\raylib\src\rcore.c ... \
-lgdi32 -lkernel32 -lmsvcrt -luser32 -lopengl32 -Xlinker /NODEFAULTLIB:libcmt

@sakgoyal
Copy link
Author

sakgoyal commented Oct 3, 2025

I would appreciate it if somebody could review this and suggest how I can improve this. I dont think my solutions for aggregate initializers is good, but I am not sure how to improve it.

@raysan5
Copy link
Owner

raysan5 commented Oct 3, 2025

@sakgoyal Thanks for the review, I see multiple improvements that can be implemented but I'm afraid external libraries should not be modified on raylib side because once updated to latest versions, changes will be lost. Still, some of the them are managed by me so only libraries managed by other developers will suffer that fate.

I also see some specific changes that I don't understand why are required. Added some notes.

Also, about coding conventions, raylib uses a space before asterix on casting, please, could you review that? (i.e. (float*)--> (float *).

{
drwav wav = { 0 };
#ifdef __cplusplus
drwav_data_format format = {};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is required? I prefer to avoid it.

#endif
struct HINSTANCE__;
#if defined(__cplusplus)
extern "C" {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmh... why is this required? Because name mangling?

void *data = NULL;

#ifdef __cplusplus
cgltf_options options = {};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to avoid the __cplusplus check only for that.

@sakgoyal
Copy link
Author

sakgoyal commented Oct 5, 2025

I will revert GLFW and qoa.

is jar_* managed by you? I couldn't find it anywhere else.

my fix for tinyobj_loader was actually fixed 3 years ago. seems like that update was not pulled in.

RGFW seems to be introducing some breaking changes for v1.8 (removing gamepad support, and more). so that will require a rework of the RGFW backend in raylib. for now, I think backporting this change is useful for now while 1.8 is being worked on

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.

2 participants