不能定义声明dllimport_在 C++ 类中使用 dllimport 和 dllexport

本文详细介绍了在 C++ 中如何使用 dllimport 和 dllexport 属性来导出和导入类。强调了在导出类时,整个类及其成员函数和静态数据成员都会被导出,并且不能在导出类中对成员进行显式声明。同时,文章提到了继承、选择性成员导入/导出的规则和注意事项,以及对导出接口设计的影响。
摘要由CSDN通过智能技术生成

在 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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值