C ++中类声明中的CP_EXPORT

时间:2010-04-21 23:47:43

标签: c++ class compiler-construction

当一个类被声明为这样时意味着什么:

class CP_EXPORT CP_Window : public CP_Window_Imp

CP_EXPORT部分的意思/暗示是什么?

3 个答案:

答案 0 :(得分:3)

CP_EXPORT很可能是一个从动态库中有条件地导出或导入类的宏。

例如,使用Visual C ++时,使用宏来有条件地在使用dllexport and dllimport之间进行选择。这允许相同的头用于构建DLL本身的项目和链接或加载DLL的任何项目。

答案 1 :(得分:2)

您使用的是C-Pluff吗?

定义:

#define     CP_EXPORT
    Declares a symbol to be exported for inter-module usage. 
#define     CP_IMPORT
    Declares a symbol to be imported from another module. 
#define     CP_HIDDEN
    Declares a symbol hidden from other modules. 

答案 2 :(得分:1)

CP_EXPORT是一个宏,它扩展为某些特定于编译器的特殊构造(在MSVC中可能为__declspec或在gcc中为__attribute__)。要确切了解什么,您需要搜索CP_EXPORT

的定义