1. What is the purpose of using a DLL over a .lib or just a single .exe?
2. What exactly (in VC++) does __declspec(dllimport) and __declspec(dllexport) do and where would you use them?
3. What is the correct way of using and linking DLLs?
4. How do you export things like template classes?
5. How do I setup VC++ to copy the generated DLL to a different location?

Any help would be appreciated.

Edited 5 Years Ago by tomtetlaw: n/a

1. What is the purpose of using a DLL over a .lib or just a single .exe?

Smaller executable size, smaller memory footprint, and easier update deployment of the library code (eg. the executable need not be recompiled).

2. What exactly (in VC++) does __declspec(dllimport) and __declspec(dllexport) do and where would you use them?

They tell the compiler to place names in the import and export sections of the DLL, respectively. It's like marking names as public for a DLL, which makes them visible to calling code.

3. What is the correct way of using and linking DLLs?

This is a documentation question (assuming you use Visual Studio).

4. How do you export things like template classes?

You don't. :)

5. How do I setup VC++ to copy the generated DLL to a different location?

You mean like an installer? Otherwise, just manually move the generated DLL to wherever you want.

Thankyou for your answers :)

I mean like a post-build action which moves the dll from the VC++ project file to a different location, because I don't want to have to manually move it every time I compile.

This article has been dead for over six months. Start a new discussion instead.