On the Allegro download files page, it gives you an option between static and dynamic binaries for Windows. What are the differences?
Most programs have a lot of information that is necessary to run correctly. This makes the file size extremely large. But by dynamically linking libraries, you can reduce the executable size. The overall size wont differ too much, but you can reuse the same dynamic library for multiple programs. Static linking puts all the eggs in one basket. You won't need a seperate library file, but size is compromised.
For example: A simple allgro program.
(These values are guestimated)
Statically linking a simple program
900kb for program
Dynamically linking
60kb for program
700+kb for dynamic library
[ February 05, 2002: Message edited by: DanielH ]
So dynamic is best? I assume it is more tricky to use dynamic binaries.
I assume it is more tricky to use dynamic binaries.
Actually, it's the other way around.
If you want to link Allegro dynamically, you just have to compile everything normally and then include the allegro.dll to the program's directory or to windows\system.
If you want to link statically, you need to make Allegro with a different option and include some preprocessor statement to your source files. However, the executable is the only thing, beside data, needed to run the program.
Normally, an exe linked statically with the library is smaller than the combination of a dynamically linked exe and the dll. So unless you are shipping several executables or the user has other Allegro apps on their computer, it seems logical to link statically for your end-user versions. If you tweak the Allegro sources in any way, you should absolutely anyway úse the static lib to avoid conflicts with other Allegro software.
IMO it's best to compile Allegro with make all to generate both plus debuging and profiling versions. For development use the dynamic varieties, for distribution you should provide the possibility to get the statically linked program, or maybe both.
[ February 06, 2002: Message edited by: Mars ]