Главная страница | назад





Article #19331: A Nice Macro for Exporting classes and functions

 Question and Answer Database
FAQ4331C.txt :A Nice Macro for Exporting classes and functions
Category :Linker
Platform :All Windows
Product :BC++4.5x, BC++5.x, C++Builder1.0, C++Builder3.x, C++Builder4.x, TC++Win4.5,
Question:
What should I put before a class or function when exporting it from a DLL?
Answer:
Use the following macro:
#ifdef __DLL__
#define DLL_EXP __declspec(dllexport)
#else
#define DLL_EXP __declspec(dllimport)
#endif
As:
// For a function
extern "C" DLL_EXP Fido();
// For a class
class DLL_EXP TFido;
2/9/1999 10:30:56 AM

Last Modified: 01-SEP-99