DLL's and EXE

Dec 6, 2011 at 9:04pm
I want to know if it's possible to merge a EXE file with DLL. Or just compile the DLL source in the EXE project?

I'm using SDL right now and it's already require like 6 dlls files for my program.

1
2
3
4
5
6
jpeg.dll
libpng12-0.dll
libtiff-3.dll
SDL.dll
SDL_image.dll
zlib1.dl


I've seen alot of programs using a single exe file but hiding the DLL files somewhere. Like Spotify using zlib libary but i can't find the DLL in the same directory as the EXE.
Dec 6, 2011 at 10:46pm
In general, merging an EXE with a DLL happens at runtime when the dynamic linker loads your application, notices the DLL references, loads the DLL, resolves the references, then lets your application run.

To "get rid of the DLL", you need to make use of static linking - which requires "static link libraries" (generally suffixed with .lib under Windows, so you'd need to have jpeg.lib, libpng12-0.lib, libtiff-3.lib, etc available at build-time).

Switching between the two is usually a linker flag, or a Project property (if you're using an IDE).
Dec 6, 2011 at 11:38pm
Oki

I tried this tutorial

http://www.learncpp.com/cpp-tutorial/a2-using-libraries-with-visual-studio-2005-express/

I'm using Visual Studio 2010 as IDE. But it's seems it still want SDL.dll even if i included the lib files in my project :/
Dec 7, 2011 at 12:03am
I just grabbed a copy of the SDL download (both 1.2.14-VC6 and 1.2.14-VC8) from

http://www.libsdl.org/download-1.2.php

... and the .lib that is provided in there is the dynamic link version (which is what most people want/use/prefer). You're going to need to recompile SDL by yourself to make a static link version (and then the .lib will _probably_ be called a different name - which is what you use in your linker properties to differentiate between the two different libraries).
Topic archived. No new replies allowed.