Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » How does distribution of dlls work with allegro?

This thread is locked; no one can reply to it. rss feed Print
How does distribution of dlls work with allegro?
AleaInfinitus
Member #18,873
December 2020

I've finished my project, but I'm not sure what the standard practices are for distributing your project with allegro and its underlying dlls.

Can anyone give me advice on what I should include in my github repo or my itch release?

SiegeLord
Member #7,827
October 2006
avatar

This advice applies to the official binaries you get from github.

If you're using MSYS2/MinGW, the easiest way to distribute things is to link against the monolith dll and then you only need to include the C/C++ runtime dlls which you can find in the MinGW directory. In total, you'll need:

allegro_monolith-5.2.dll
libgcc_s_seh-1.dll
libstdc++-6.dll
libwinpthread-1.dll

If you're using MSVC with Nuget packages, then it's pretty easy to link statically. If you also link in the C/C++ runtime statically, there won't be any dlls at all. I don't recall what the C/C++ runtime DLL for MSVC is called (and you probably can't redistribute it either, you're supposed to tell people to download the install from Microsoft).

In general, if you're not sure, you can use the Dependency Walker (https://www.dependencywalker.com/) which will tell you which DLLs your program needs. Include all of those that don't appear to be included with Windows.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

amarillion
Member #940
January 2001
avatar

If you use msys or msys2, you can use objdump to find out which DLL dependencies you need.

For example, if you run:

objdump -p *.exe *.dll | grep 'DLL Name:'

This gives you a list of DLLs that your EXE is dependent on. Search your system for the DLLs (if your program runs, they must be somewhere on your system). Then copy those DLLs into the current directory and run the same command again. The list gets longer: the new DLLs also have dependencies that you have to include as well. Keep running this until the list of DLLs no longer changes.

I write bash scripts for myself that contain this snippet:

for i in $(objdump -p *.exe *.dll | grep 'DLL Name:' | sort | uniq | sed "s/\s*DLL Name: //")
do
  if [ -e $i ]
then
  echo "FOUND: $i"
else
  echo "MISSING: $i"
fi
done

There are certain DLL dependencies that you can assume are standard on windows, they tend to be all caps filenames, and they are in C:\Windows

Finally, pay attention to whether you have 32-bit or 64-bit exe/dlls. On Msys you can check by running the file command. That will report them as PE32 (32 bit) or PE32+ (64 bit)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

If you downloaded my binaries, there is a /bin/dlls folder. Just include the dlls in there, and the appropriate dll for allegro whether it's debugging or not. Or link statically and don't distribute any dlls. There's a list of libraries to static link in the base folder.

Go to: