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.

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

Cross compile c and msvc c++ support
@raysan5
Copy link
Owner

raysan5 commented Oct 9, 2025

@sakgoyal Yees, jar_* is mostly managed by me at this moment... or afaik, it is not available in an other repo. The tinyobj_loader can be updated.

raysan5 and others added 18 commits October 9, 2025 13:49
The tool can work with other libraries following `raylib.h` structure, keeping the `raylib_parser` name could be missleading. Also added an icon an reviewed Makefile an CI.
Co-authored-by: pyrokn8 <202429796+pyrokn8@users.noreply.github.com>
* ADDED: example: shapes_recursive_tree

* [examples] Added shapes_recursive_tree

* [examples] shapes_recursive_tree: adjustments

* Reduced tree depth from 12 to 10

* new shapes_recursive_tree.png

* follow the conventions

* follow the conventions 2
* [examples] Add shapes_triangle_strip

* Remove functions
* ADDED: example: `shapes_kaleidoscope`

* Add line reflection

* Updated with `rexm update`

* Follow raylib's conventions
@sakgoyal
Copy link
Author

sakgoyal commented Oct 9, 2025

Oh man I messed up the force push. Let me try fixing this. I am going to close this an open a new PR. Not sure how to resolve this.

@sakgoyal sakgoyal closed this Oct 9, 2025
@sakgoyal sakgoyal deleted the compile++ branch October 9, 2025 17:58
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.

6 participants