1. HELP RayGui DLL

Hello all,

I am trying to get Raygui built into DLL, but I keep coming up short. I've both the GCC and MSVC methods of trying to compile and build it (https://github.com/raysan5/raygui), but I keep coming up with errors. I even tried building Raylib 5 using the makefile which includes RayGUI (as long as you set the option to true, from false) (https://github.com/raysan5/raylib/blob/master/src/Makefile) and it still comes up with build errors. It seems to be linker errors, even though I only change the bare minimum required. If anyone can help that would be great.

new topic     » topic index » view message » categorize

2. Re: HELP RayGui DLL

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: HELP RayGui DLL

ghaberek said...

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 

new topic     » goto parent     » topic index » view message » categorize

4. Re: HELP RayGui DLL

Hello,

Until yesterday evening, I was unable to create a working raygui.dll.
Then it worked.And you only need one dll.
(raylib and raygui in one dll)

I tried it with your wrapper for Euphoria 64-bit and 32-bit.

Because I had to spend a long time figuring it out, I wrote it down.
Maybe it will save others some time.
I wasted endless time with tdm-gcc. But all my DLLs died with signal 11 or didn't export any functions at all.

I then started completely from scratch:

First, I removed TDM-GCC (from %PATH%).

Then I installed w64devkit.

https://github.com/skeeto/w64devkit/releases/download/v2.5.0/w64devkit-x86-2.5.0.7z.exe for 32-bit
https://github.com/skeeto/w64devkit/releases/download/v2.5.0/w64devkit-x64-2.5.0.7z.exe for 64-bit

Simply unzipped each one into its own directory using 7zip (7zip can unzip the exe directly, rename it beforehand if necessary (remove .exe)).

w64devkit comes with its own shell (start w64devkit.exe).

Then fetch the current Raylib/raygui sources from GitHub and copy them into a directory structure like this:

./raylib_source 
 
             | 
 
             |--  raylib 
 
             | 
 
             |--  raygui 

Then edit this Makefile:

 
./raylib_source 
 
             | 
 
             |--  raylib/src/Makefile 
 
             | 
 
             |--  raygui 
 

# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) 
RAYLIB_LIBTYPE       ?= SHARED. 
 
 
# Include raylib modules on compilation 
# NOTE: Some programs like tools could not require those modules 
RAYLIB_MODULE_AUDIO  ?= TRUE 
RAYLIB_MODULE_MODELS ?= TRUE 
RAYLIB_MODULE_RAYGUI ?= TRUE 
 
 

If you stick to the directory structure specified above, these are the only adjustments you need to make.

A simple make in raylib/src will then generate a raylib.dll with integrated raygui. you then need to adjust raygui.e and raylib.e to the (eventuelly new filename).

If the following error (or something similar) occurs: (raylib source comes with 64bit rc.data files)

D:/testpool/raylib_new/w64devkit/bin/ld.exe: i386 architecture of input file `./raylib.dll.rc.data' is incompatible with i386:x86-64 output 
collect2.exe: error: ld returned 1 exit status 
make: *** [Makefile:782: raylib] Error 1 

you must adjust raylib.dll.rc.data accordingly:

for32bit target dll 
windres raylib.dll.rc -o raylib.dll.rc.data --target=pe-i386 
 
 
for 64bit target dll 
windres raylib.dll.rc -o raylib.dll.rc.data --target=pe-x86-64 

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu