These are probably easy, but since I have no idea:
1. What exactly is a DLL?
2. What are DLL's used for?
3. How do you make one?
Printable View
These are probably easy, but since I have no idea:
1. What exactly is a DLL?
2. What are DLL's used for?
3. How do you make one?
A DLL is a file that contains functions. For example all the api functions are inside dll's. Dll's are used for more organised code and for smaller exes.
To make one go to new project and choose win32 dynamic link library.
So if I had an exe and a dll, I can have my functions in the dll and when I change something I can just send a user the dll?
Well, it depends of the changes, but generaly you can do that.
Ok, one more question, how do you call the functions inside the DLL?
:)
You can also use Load-TIme Dynamic Linking:
Quote:
Using Load-Time Dynamic Linking
After you have created a DLL, you can use it in an application. The following file, LOADTIME.C, is the source code for a simple console application that uses the myPuts function exported from MYPUTS.DLL.
// File: LOADTIME.C.
// A simple program that uses myPuts from MYPUTS.DLL.
#include <windows.h>
VOID myPuts(LPTSTR); // a function from a DLL
VOID main(VOID)
{
myPuts("message printed using the DLL function\n");
}
Because LOADTIME.C calls the DLL function explicitly, the module for the application must be linked with the import library MYPUTS.LIB. For more information about building DLLs, see the documentation included with your development tools.
Parksie, two things:
1. When I try to compile this code, I get this link error: "LINK : fatal error LNK1104: cannot open file 'mylib.lib'". Isn't that what I am compiling? Also, when I take mylib.lib out of the project settings i get unresolved external link errors.
2. In loadlib.cpp, where you have the function pointers and finding the function, do I have to do that for every function I write?
1. MyLib.lib is generated when you compile the DLL project, not the test program
2. Yes - however this would normally happen when your program was initialised so you only need to use the function call.
Ok, thanks a lot for the help and the project :)