Jump to content
  • Advertisement
Sign in to follow this  
tibberous1

Building my DLL's into my exe with VC++ 6.0

This topic is 3849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a program that currently needs several DLL's, and was hoping to make it into a single exe. Does anyone know how to do this? I am using MS VC++ 6.0.

Share this post


Link to post
Share on other sites
Advertisement
It's possible, via a list of hacks, but not advisable. Building your DLLs into the executable entirely undermines the point of dynamic-linking.

If possible, statically link to everything so that there is no need for the DLLs. Failing this, package the program and all of its resources & DLLs into a self-extractor. Personally, I hate all this business of registering libraries with the system and dipping into the registry as a general-purpose database - avoid it - but SFX archives are a very sensible way to distribute complex programs.

But if you have your heart set on embedding DLLs (I know I've encountered some hack-tastic situations where it has been almost necessary) then the cleanest approach is to link them into the executable as binary resources, then dump them to disk at run-time and late bind with LoadLibrary.

Admiral

Share this post


Link to post
Share on other sites
Why are you still using Visual C++ 6.0? The 2005 Express Editions are free of charge(even for commercial usage) and more up-to-date. VC++ 6 is over 10 years old and really outdated.

Toolmaker

Share this post


Link to post
Share on other sites
Quote:
Original post by Toolmaker
Why are you still using Visual C++ 6.0? The 2005 Express Editions are free of charge(even for commercial usage) and more up-to-date. VC++ 6 is over 10 years old and really outdated.

Toolmaker
If this is for work, he may not be the one choosing the compiler. Porting a huge old C++ project from MSVC++ 6.0 to a newer version can take a lot of time. Bottom line - in a business environment different rules apply.

Share this post


Link to post
Share on other sites
But most people who post here with VC6.0-related questions don't do it because they're forced to use 6.0 at work.

Most people use it because they don't know how bad an idea it is.

Share this post


Link to post
Share on other sites
Fair point, although I still have a soft spot for it. I remember thinking it was pretty damn good when I first used it :)

Share this post


Link to post
Share on other sites
I am using VC++ because I am modifying a project that was written with it. It was the only thing I could get the project to compile in, and that took about three hours.

I am not sure how to statically link the DLL's, but that is basically what I think I am trying to do - I just know that the original program was twice the size of mine, and didn't need and external DLL's, so they were somehow part of the exe. This might not matter as much as I thought it would, since I am going to make an installer with NSIS, and it hardly matters how many files there are if it is going in the Program Files folder anyway.

Share this post


Link to post
Share on other sites
just to clear up some terminology, because it may help you google correctly:

1. DLLs are by definition DYNAMICALLY linked libraries.
2. You want to statically link a library. Aka build and use a static library not a dynamic library.
3. In Visual C++ 6 a static library has a .lib extension (not .dll) and is a seperate project type (if I remember correctly.
4. IF you have a static library it is extremely easy and obvious to link to it.
5. If you have a dynamic library, there are ways to load it out of an embedded reasource at runtime but I have no experience with this - so I cannot give you all of the complex details.

The above all apply if you are trying to use a certain library or libraries intentionally.

If however your problem is that there are new dependencies that you know the game didn't used to have, and you don't know why or what they are ... there are tools to investigate the dependencies and help you find them. In my case a few years ago I had a program with a missing DLL that I couldn't remember what it was, so I used a dependency viewer program to list the dependencies and matched the list with what I was supplying ... until I found what elements were missing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!