Page 1 of 2

merge DLL in EXE

Posted: Fri Jul 11, 2008 10:52 pm
by EvIl_DeViL
hi to all! does anyone know a way to merge a dll file into the main exe?
(possibly freeware)
many programs that do this thing are for .NET... i want something for C++

Posted: Fri Jul 11, 2008 11:01 pm
by NeRoX
Put the DLL into a binary resource and use LoadResource to access it. There are samples around somewhere.

Posted: Fri Jul 11, 2008 11:01 pm
by CuteAlien
Dll's are dynamic link libraries. If you want the library in your executable you will have to link statically. It's usually a linker option, but I haven't tried to link Irrlicht statically so far, so not sure if that will currently work without problems.

Posted: Fri Jul 11, 2008 11:04 pm
by NeRoX
Oh, thought closed-source dll... If you want Irrlicht DLL or any other Open Source DLL you can just put their source & header files into your project..

Posted: Fri Jul 11, 2008 11:27 pm
by EvIl_DeViL
@ NeRoX: i'm talking also about d3dx8.dll, d3dx9.dll and audiere.dll...
you know... 4 .dlls i think are too much...
didn't find anything in dev-cpp about to link dll...

Posted: Sun Jul 13, 2008 10:49 am
by Luke
something like this one: http://www.molebox.com/ (just a random google)

not sure if there are any free ones.

Posted: Mon Jul 14, 2008 12:44 am
by wyrmmage
do you want to embed the dll into your .exe so you don't have to ship it, or do you want to just link to it? You can do both with Dev-C++ :)
-wyrmmage

Posted: Mon Jul 14, 2008 7:57 am
by JP
4 .dlls isn't really too much... it may not look as clean as you'd like having those lying around but lots of applications use many more .dlls.

And it's not going to save you any physical space by sticking them in your .exe as they'll just add that much more size, it'll basically just hide them from sight which is only really necessary if you're incredibly anal :lol:

Personally i wanted to do this before as i thought it was ugly having all the .dlls lying around but then i figured it didn't really matter and gave up on the idea.

But as has been suggested you'll want to create a static lib of irrlicht to do this and also compile in DX statically to irrlicht, if possible :lol:

For audiere i'm not sure if it's open source so you might have to use one of the other suggestions for that.

Posted: Mon Jul 14, 2008 9:30 am
by lostclimategames
I personally think that dll's seem more professional, makes it look like you didnt just use some point and click "make a game in 30 minutes" programs. It makes it feel that you worked on it researched the software libraries you needed, linked them together with your own programming to create your very own application.

Posted: Mon Jul 14, 2008 10:00 am
by sudi
embeding dlls is simple.
u just define them as resource and then load them. problem is then u have to load the function u want to use as well

Posted: Tue Jul 15, 2008 1:34 am
by wyrmmage
alternatively, you can use a gcc program to create a static library from the dll (no source code needed) and then just link to the static library; this allows you not to have to specify the load functions :)
-wyrmmage

Posted: Tue Jul 15, 2008 9:24 am
by sudi
yeah he is right forgot about that option

Posted: Tue Jul 15, 2008 5:08 pm
by EvIl_DeViL
so you mean i should use C:\Dev-Cpp\bin\dlltool.exe?
for example... what syntax i have to use to convert for example d3dx9.dll in a .lib? i used

dlltool -l libD3dx9.lib

but it create only 2Kb file...

Posted: Tue Jul 15, 2008 7:24 pm
by rogerborg
From a cursory glance, it appears that dlltool only creates an import library for the dll, not a static version of the dll.

Posted: Tue Jul 15, 2008 11:57 pm
by wyrmmage
It's tricky to get working, and you actually have to run at least two commands if I remember correctly; unfortunately I've lost my notes I took when I was doing this, so you'll have to look it up yourself I'm afraid :(
-wyrmmage