The Allegro Wiki is migrating to github at https://github.com/liballeg/allegro_wiki/wiki

Static and Dynamic Link

From Allegro Wiki
Jump to: navigation, search

Static Link

Advantages
  • Access to the full capabilities of Allegro 5.
  • The result is a single executable file with all the binaries inside.
  • Smaller executable size, since static linking only links the necessary portion of the binaries.
Disadvantages
  • If you want to release a new version of your game, you need to distribuite the entire executable (with all the necessary binaries inside), even to those who have already downloaded a previous version of your game.

Statically linking the libraries allows you to end up with a single executable file that contains all the binaries inside of it, so when the users open your program's folder they are only going to see one executable file along with the rest of the files related to your game (images, sound etc..).

A static link can be considered to be an elegant way to distribute your application. If we were only using Windows libraries, this would be unnecessary. Not only would it be unnecessary, but it would also be discouraged because when you statically link libraries the weight of your application increases because it contains all the libraries inside of it which makes its distribution more difficult.

It would not make sense to link to Windows libraries statically because they're present in all Windows OS'es. With Linux things might change. Well At least that is what I have read somewhere. So, for that reason and since the Allegro binaries aren't included in any OS (yet :D) then they must be present with your executable file, either dynamically or statically linked.

Dynamic Link

Advantages
  • Easy and Fast Installation.
  • Access to the full capabilities of Allegro 5.
  • You can release a new version and offer people (that have already downloaded your game) to just download the executable file which normaly have a very small size.
Disadvantages
  • Executables (games) have to be distributed along with the binaries.
  • More size, since you have to distribute the entire allegro binarie even if your game just use a portion of it.