在 C++ 类中使用 dllimport 和 dllexportUsing dllimport and dllexport in C++ Classes
11/04/2016
本文内容
Microsoft 专用Microsoft Specific
可以用或属性声明 c + + 类 dllimport dllexport 。You can declare C++ classes with the dllimport or dllexport attribute. 这些形式表示已导入或导出整个类。These forms imply that the entire class is imported or exported. 以这种方式导出的类称为可导出类。Classes exported this way are called exportable classes.
以下示例定义了可导出类。The following example defines an exportable class. 将导出其所有成员函数和静态数据:All its member functions and static data are exported:
#define DllExport __declspec( dllexport )
class DllExport C {
int i;
virtual int func( void ) { return 1; }
};
请注意, dllimport dllexport 禁止对可导出类的成员显式使用和属性。Note that explicit use of the dllimport and dllexport attributes on members of an exportable class is prohibited.
dllexport 类dll