dll linking

Started by
9 comments, last by BloodLust666 18 years, 6 months ago
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.
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Advertisement
You must have sources of that DLL, or you must have LIB with compiled code in them.
ai-blog.org: AI is discussed here.
I have them, i want them staticly linked (in code)
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
[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.
moe.ron
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) ?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
see, thing is, i don't have the source for the dll, in fact, it's "d3dx9_26.dll" i'm trying to link.
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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.
ok, i can add it to the resource folder. how would i do the "loadlibrary"? can you show me an example?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
or a tutorial on how to link a dll with loadlibrary
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML

This topic is closed to new replies.

Advertisement