allegro5 icon indicating copy to clipboard operation
allegro5 copied to clipboard

how do I make allegro_monolith-5.2.dll stay static?

Open Ivan-Sandro opened this issue 4 years ago • 6 comments
trafficstars

Captura de tela 2021-08-15 164214

When I start any program with Allegro, it is necessary this .dll, I know that it is possible to put this.dll in the system folder and in the folders where my progam is for the executable work normally, but I was wondering how to put this .dll statically, so I do not need to continue copying and pasting in all my projects, or in the system folder, I'm using Code::Blocks 20.03 and I can't find that answer anywhere.

Ivan-Sandro avatar Aug 15 '21 19:08 Ivan-Sandro

First, download the static binaries for both Allegro and the dependencies. Extract them all somewhere. Then, you need these link commands:

-static-libgcc
-static-libstdc++
-static
-lpthread
-lallegro_monolith-static
-ldumb
-lFLAC
-lfreetype
-ljpeg
-lopusfile
-lopus
-lphysfs
-lpng16
-ltheoradec
-lvorbis
-lvorbisfile
-logg
-lwebp
-lzlib
-ldsound
-lopengl32
-luser32
-lgdi32
-lcomdlg32
-lole32
-lwinmm
-lkernel32
-lpsapi
-lshlwapi

SiegeLord avatar Aug 15 '21 21:08 SiegeLord

The error continues, I already had the Static binaries, downloaded the dependencies and put them in Allegro5 folder, files in lib with lib, files in include with include, the compiler give me an error saying that files not be found, but I checked and added the lib folder for the compiler search link, and this problem was resolved, but still need this .dll, and my release executable from 61Kb went to 1.94M (the debug increased too), which I found strange because I still need the dll, so here's this observation.

Ivan-Sandro avatar Aug 16 '21 17:08 Ivan-Sandro

static linking increase the size of the executable file. What is the problem?

SeanTolstoyevski avatar Nov 23 '21 16:11 SeanTolstoyevski

Even with my compiler having the dependencies, the series of commands given earlier, compiling correctly, and increasing the size of the final executable, the monolith dll mentioned earlier is still required in the executable folder.

The dll requered: image

I would like this dll to be statically linked... how do I do this?

Ivan-Sandro avatar Nov 23 '21 22:11 Ivan-Sandro

DLL files cannot be statically linked. Instead you need the .a file for MinGW or gcc and the .lib file for VS2019.

Example for MinGW in static: -Llibs /libs/liballegro_monolith-static.a -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic -lopengl32 -lddraw -lShlwapi -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 -ldinput -lwinmm -ldsound -ldxguid Although I am using Windows 10, I am not fully familiar with CL commands for VS2019. I am not using it as an IDE.

SeanTolstoyevski avatar Nov 24 '21 17:11 SeanTolstoyevski

Attach your .cbp file or check your link commands to make sure you're not still linking the dynamic dll archive. You want to link ONLY the static monolith for allegro as SiegeLord directed earlier.

EdgarReynaldo avatar May 17 '22 20:05 EdgarReynaldo