raysan5 / raygui

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

Compiling as a shared library on Linux (documentation) #146

Closed weskerfoot closed 3 years ago

weskerfoot commented 3 years ago

Currently, in order to get it working as a shared library on Linux (which, e.g. is necessary if you want to use it with https://github.com/Guevara-chan/Raylib-Forever or things like Python/Lua/etc), you need to do something like the following

mv src/raygui.h src/raygui.c && gcc -shared -fpic -DRAYGUI_SUPPORT_ICONS -DRAYGUI_IMPLEMENTATION -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 src/raygui.c -o raygui.so

It would be useful if it were documented somewhere, or built into the Makefile, since it took me a while to figure out that GCC behaves differently if you give it a .h file vs a .c file, and doesn't give any visible warnings that it won't work (i.e. nm -D raygui.so won't list the correct symbols if you compile it as a .h file).

raysan5 commented 3 years ago

@weskerfoot Just added a note in the README.md.