allegro5
allegro5 copied to clipboard
how do I make allegro_monolith-5.2.dll stay static?

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.
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
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.
static linking increase the size of the executable file. What is the problem?
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:

I would like this dll to be statically linked... how do I do this?
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.
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.