raysan5 / raygui

A simple and easy-to-use immediate-mode gui library
zlib License
3.42k stars 297 forks source link

Make linking easier for scripting languages #143

Closed adamlwgriffiths closed 3 years ago

adamlwgriffiths commented 3 years ago

Raygui being a header-only library, makes binding to other languages (non-C, ie python, lua, etc) more difficult. These languages can only parse the symbol definitions, not the inline implementation. There are a number of community repositories that make a fake raygui .so file, but there seems to be no standard way to do it. Most of these do it in a way that is specific to the developers build environment (binary only releases, custom raylib checkout, etc).

I've managed to get raygui built using a barebones .c file. I've built this as non-standalone, but it doesn't link against the raylib library, so there are missing symbols for certain functions

undefined symbol: IsMouseButtonDown

I would guess the intended way to do this is to build raylib statically, and then build raygui as a shared object that links against raylib?

There also seems to be a "RAYLIB_MODULE_RAYGUI" in raylib's Makefile, but setting "-DRAYLIB_MODULE_RAYGUI" doesn't seem to do anything.

It would be really appreciated if you could provide some form of "official" mechanism to let scripting languages bind against raygui more easily. At the moment this seems far more complicated than it needs to be.

This also applies to raylib's 'physac.h', which is also a header-only library.

raysan5 commented 3 years ago

I'm afraid this is out-of-scope for this project. It's designed to be a single-file header-only C library. It's up to users requiring some other design to implement it.

adamlwgriffiths commented 3 years ago

Understood, I just felt it might be a simple matter of adding an option to the raylib cmake file that includes the raygui header. This would simplify this for many users/use-cases downstream.

A more complicated way would be to create a separate project that recevies the raylib library pointer and forwards raygui calls from the requires functions into the library itself. But that's more effort than I'm able to give at the moment.

brno32 commented 11 months ago

could language bindings be automatically generated for this library in the same way bindings were generated for raylib?