Re: HELP RayGui DLL
- Posted by Icy_Viking in January
- 607 views
I don't think I've ever tried building any of the raylib projects from source. Could you share some of the errors you're getting?
The building directions for raygui don't make any reference to raylib. So you're probably getting errors trying to find any of the raylib functions.
I think they're assuming you're linking raylib statically but then building raygui as a DLL? That seems weird and makes the directions incomplete.
The steps below worked for me. I had to add some options to the gcc command so it could link to raylib.dll in the other source directory.
Build raylib.dll from source
git clone https://github.com/raysan5/raylib raysan5\raylib cd raysan5\raylib\src mingw32-make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED
Build raygui.dll from source
git clone https://github.com/raysan5/raygui raysan5\raygui cd raysan5\raygui\src copy raygui.h raygui.c gcc -shared -o raygui.dll raygui.c -I../../raylib/src -L../../raylib/src -DRAYGUI_IMPLEMENTATION -DBUILD_LIBTYPE_SHARED -static-libgcc -lopengl32 -lgdi32 -lwinmm -lraylib -Wl,--out-implib,librayguidll.a
-Greg
Thanks Greg. However I keep hitting this snag right here. I get the error ld returned exit 1 status raylib.dll.rc.data: file not recognized: file format not recognized
I found this: https://github.com/raysan5/raylib/discussions/2560 I tried the windres raylib.dll.rc -o raylib.dll.rc.data --target=pe-x86-64 but it comes up with the error Can't detect target endianness and architecture I'm using TDD-GCC-64 under Windows 11 Pro 64-bit. I'll try a few other things and see if I can get it working myself.
EDIT: Ok I got the first part done. I was able to build Raylib using the mingw32-make command. I had to do this,
windres raylib.dll.rc -o raylib.dll.rc.data --target=pe-i386 then mingw32-make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED
When trying to build raygui DLL, I get this error
gcc -shared -o raygui.dll raygui.c -I../../raylib/src -L../../raylib/src -DRAYGUI_IMPLEMENTATION -DBUILD_LIBTYPE_SHARED -static-libgcc -lopengl32 -lgdi32 -lwinmm -lraylib -Wl,--out-implib,librayguidll.a At line:1 char:175 + ... HARED -static-libgcc -lopengl32 -lgdi32 -lwinmm -lraylib -Wl,--out-im ... + ~ Missing argument in parameter list. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingArgument
EDIT 2: Alright, I got it to work using this command.
gcc -shared -o raygui.dll raygui.c -I../../raylib/src -L../../raylib/src -DRAYGUI_IMPLEMENTATION -DBUILD_LIBTYPE_SHARED -static-libgcc -lopengl32 -lgdi32 -lwinmm -lraylib