• Advertisement
Sign in to follow this  

dll linking

This topic is 4519 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

how do i "statically" link dll's within my code? I'm wanting to do this so ppl running my programs don't need to find that file.

Share this post


Link to post
Share on other sites
Advertisement
[disclaimer]
Keep in mind that I am posting this assuming that you are developing for Win32 platform.
[/disclaimer]

you have the actual source code for the project? If so then just make a project that creates a static library and add all the source / header files to it. The process for creating projects will differ depending on which IDE you use (look in the documentation for it)

If you already have a library then I am not sure if that will help you because chances are its the importlib that is just used for linking to the dll. I don't think static libs == importlibs because I'm pretty sure an importlib only contains information about the exported functions/classes for the dll.

Share this post


Link to post
Share on other sites
all i'm trying to do is link a dll to my code. just like i am doing with my lib files:

#pragma comment(lib, filename)

would it just be the same thing with a dll:
// #pragma comment(dll, filename) ?

Share this post


Link to post
Share on other sites
Quote:
Original post by EvilKnuckles666
all i'm trying to do is link a dll to my code. just like i am doing with my lib files:

#pragma comment(lib, filename)

would it just be the same thing with a dll:
// #pragma comment(dll, filename) ?


No, by definition of a DLL. In order to statically link it, you need to recompile a static library, which is easy to do.

Share this post


Link to post
Share on other sites
If you do that, the dll will still need to be present when you run the program.

You could compile the dll into the executable as a resource. You would then need to write it to a file somewhere before calling LoadLibrary on it.

Share this post


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

  • Advertisement