EQuestionAnswers.com Computer/Electronics Questions and Answers
C, C++, VC++, COM/DCOM, DLL and more
#Login #Sign up  Facebook Twitter TGoogle+

#Previous question #Index of DLL Questions #Next question

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
  1. Binary i.e. math.dll
  2. Import Library i.e. math.lib
  3. math interface header i.e. math.h
In my math.h I shall declare my add() interface as
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.

 Vote 1

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)  Like 0 Unlike 0

Your message goes here:

My Post:*
Secutiry Code: ******  *
Preview this compose before posting this in discussion forum.
  1. Use [Sxx] code to show smiles. Example [S02]
  2. Use [URL ], example [URL http://www.google.com/]
  3. To display code or un formatted text use [CODE] [/CODE]. Example: [CODE] printf("Hello world"); [/CODE]
 [S01]   [S02]   [S03]   [S04]   [S05]   [S06]   [S07]   [S08] 
 [S09]   [S10]   [S11]   [S12]   [S13]   [S14]   [S15]   [S16] 
 [S17]   [S18]   [S19]   [S20]   [S21]   [S22]   [S23]   [S24] 

Note: Only members are allowed, * fields are mandatory.