I have created a simple dll project with a function
But I do not inderstand how to include it into a new project
Can you help me?
:confused:
Printable View
I have created a simple dll project with a function
But I do not inderstand how to include it into a new project
Can you help me?
:confused:
There are two forms of using a DLL - explicity (run-time dynamic linking) and implicitly (Load time dynamic linking).
Run-Time Dynamic Linking
1. A DLL can be loaded by calling LoadLibrary.
2. Using the Handle returned above, you can then call the function exported by a call to GetProcAddress.
3. This will return a Function Pointer to the function, that you may use.
4. Free the loaded DLL using FreeLibrary.
Load-Time Dynamic Linking
1. Add the .lib file of your DLL to the client project.
2. Include the header.
3. Call the exported function.
Can u clear some of my doubts. Is my understanding right???
1. If i want my dll to support run-time dynamic linking, i must also provide an .DEF file which has the function declartions along with ordinal no. Now if i want to call a function in the dll, i must have the dll...., plus the DEF file included in my project. Now i can call the function after loading the dll.
Do I not need an header file also, or the DEF file will do???
How do i create an DEF file???
2. If i want my dll to support Load time dynamic linking, i must also provide an .lib file. Now if i want to call a function, what all do i need to use and do??? Do i need a header file, dll, and the lib file, or lib file and dll will do????
How do i create a lib file???
I created a win32 dll using appWizard, it automatically created a lib file, but why not the .DEF file???
You would need to include the header file of the dll as well... ;)Quote:
Originally Posted by Siddhartha
Take a look at the following FAQ for a general overview...Quote:
Originally Posted by Pink Panther
Great link
Thanks
Only with implicitly loaded ones... ;)Quote:
Originally Posted by Andreas Masur
Can I summarize like this....
Explicit Linking...
1. Create DLL.
2. Somehow create an .DEF file (I donno how yet).
3. Preferably copy DLL into app folder, rather than system folder.
4. Include .DEF file into project.
5. Call LoadLibrary(...), to load dll.
6. Call GetProcAddress(...), to get function pointer.
7. Unload the Dll.
Implicit Linking...
1. Create DLL.
2. Create .LIB file.
3. Preferably copy DLL into app folder.
4. Include .LIB file into project.
5. Also Include header files where required.
6. Now just call the function, like one w'd call any other function.
Is that it or, is some piece missing???
Pls confirm.
Thanks in advance
1. You must not copy your dll to the system folder.Quote:
Originally Posted by Pink Panther
2. LIB is automatically created (so long as you export something), unless you choose otherwise.
Otherwise, you are right. :thumb: