What does __declspec (dllexport) do when it is added before the import function

Possible duplicate:
Windows and C ++: extern and __declspec (dllimport)
Why / when __declspec (dllimport) is not required?

I want to write a DLL project. This project includes several DLLs. They are addicted . I define some macros, for example:

#ifdef  MYDLL_DECL1
    #define  DLL_DECL __declspec(dllexport)
#else
    #define DLL_DECL __declspec(dllimport)
#endif

I defined MYDLL_DECL1 ... MYDLL_DECLn for each module . Because I thought that if I define the same macro that it will not work. But I really want to define only one macro, and I wrote a test bench. I have two modules. In the second moudle source file. I am writing code like:

#define  MYDLL_DECL
#include "moudle1.h"
#include "moudle2.h"

"MYDLL_DECL", modle1 "MYDLL_DECL", "DLL_DECL" "__declspec (dllexport)". 2 "__declspec (dllimport)", module2 import module1. , , . , OpenCV

+5
1

, . 1, __declspec(dllexport) 1 __declspec(dllimport) . , .

, , , :

#ifdef MODULE1
#define MODULE1_DECL __declspec(dllexport)
#else
#define MODULE1_DECL __declspec(dllimport)
#endif

MODULE1 module1; - . module1, MODULE1_DECL __declspec(dllexport), , __declspec(dllimport).

+5

All Articles