To answer this question we have to revisit the meaning of these keywords.
MS VC++ compiler treats any variable/function with __declspec(dllimport) as imported from other modules. For __declspec(dllexport) the mechanism is reversed. With __declspec(dllexport) keyword compiler treats this symbol to be exported from the module and thus external modules can import this symbol.
Suppose I am writing a math library which has a function add(). Now I want my add() function to export from my module or rather expose this to outside world.
In my math.c I shall write like this
int __declspec(dllexport) add(int a, int b)
return (a + b);
Now when I shall build, I shall get the binary math.dll as well as math.lib.
After getting this files I shall create by math package with three files and they are
In my math.h I shall declare my add() interface as
- Binary i.e. math.dll
- Import Library i.e. math.lib
- math interface header i.e. math.h
int __declspec(dllimport) add(int a, int b);
Any application which will use my math package will include my header at compile time. Also math.lib is needed at linking time. Finally when running the application math.dll will be needed.
You have viewed 1 page out of 27. Your DLL learning is 0.00% complete. Login to check your learning progress.
Similar topics related to this section
DLL Frequently Asked Questions
Frequently Asked Questions - DLL-files.com
Dependency Walker Frequently Asked Questions (FAQ)
Top 10 DLL Questions !
DLL COM DCOM Interview Questions and Answers
| #1 webmaster Sat 08 Feb/2014 01:51:52(GMT) || 0 || 0|
Your message goes here: