|
-
April 19th, 2005, 04:57 AM
#1
Include a dll
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?
-
April 19th, 2005, 05:09 AM
#2
Re: Include a dll
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.
Last edited by Siddhartha; May 23rd, 2005 at 05:23 PM.
-
April 19th, 2005, 06:00 AM
#3
Re: Include a dll
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???
-
April 19th, 2005, 06:05 AM
#4
Re: Include a dll
 Originally Posted by Siddhartha
There are two forms of using a DLL - explicity (run-time dynamic linking) and implicitly (Load time dynamic linking).
You would need to include the header file of the dll as well...
-
April 19th, 2005, 06:06 AM
#5
Re: Include a dll
 Originally Posted by Pink Panther
Can u clear some of my doubts. Is my understanding right???
Take a look at the following FAQ for a general overview...
-
April 19th, 2005, 06:15 AM
#6
-
April 19th, 2005, 06:20 AM
#7
Re: Include a dll
 Originally Posted by Andreas Masur
You would need to include the header file of the dll as well... 
Only with implicitly loaded ones...
-
April 19th, 2005, 06:39 AM
#8
Re: Include a dll
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
-
April 19th, 2005, 06:43 AM
#9
Re: Include a dll
 Originally Posted by Pink Panther
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.
2. LIB is automatically created (so long as you export something), unless you choose otherwise.
Otherwise, you are right.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|