动态链接库_导出类

上传者: xiaohutushen30 | 上传时间: 2019-12-21 22:01:32 | 文件大小: 57KB | 文件类型: zip
本人经过两天的研究,终于掌握了动态链接库的使用方法,动态链接库的使用上并不难,难在动态链接库中的导出类, 把dll中类的成员函数导出来才是最重要的,我就用几个例子介绍一下几种导出的方法: 第一种: 这种方法不是很好,实现的也比较麻烦,可以参考 例子中的1_DLLDemoCll工程 原理:利用虚函数导出,导出的dll中申请的对象指针,再利用虚函数的特性,利用虚函数表实现了类函数的导出,比较麻烦 建议了解一下。 第二种: 这种方法实现起来比较简单,采用的是静态加载的方式,但是有很多的局限性,因为当dll有错是整个应用都会出问题,不建 议在打的工程中使用。 具体代码实现见static_link_DLL工程,其中dll文件由Abstrct文件编译。 第三种: 这种方法是我推荐的,它是由动态加载进来的,其中实现原理是:运用抽象类,为工程创建接口,通过接口来导出类成员函数 这种方式通用性强,而且代码比较的健壮,节省内存。见工程useDLL。

文件下载

资源详情

[{"title":"( 52 个子文件 57KB ) 动态链接库_导出类","children":[{"title":"动态链接库的使用","children":[{"title":"useDLL","children":[{"title":"useDLL","children":[{"title":"useDLL.vcxproj <span style='color:#111;'> 4.30KB </span>","children":null,"spread":false},{"title":"stdafx.cpp <span style='color:#111;'> 211B </span>","children":null,"spread":false},{"title":"useDLL.vcxproj.user <span style='color:#111;'> 143B </span>","children":null,"spread":false},{"title":"stdafx.h <span style='color:#111;'> 233B </span>","children":null,"spread":false},{"title":"Abstrct.dll <span style='color:#111;'> 33.00KB </span>","children":null,"spread":false},{"title":"targetver.h <span style='color:#111;'> 236B </span>","children":null,"spread":false},{"title":"Abstrct.h <span style='color:#111;'> 132B </span>","children":null,"spread":false},{"title":"useDLL.cpp <span style='color:#111;'> 665B </span>","children":null,"spread":false},{"title":"ReadMe.txt <span style='color:#111;'> 1.51KB </span>","children":null,"spread":false}],"spread":true},{"title":"useDLL.sln <span style='color:#111;'> 885B </span>","children":null,"spread":false}],"spread":true},{"title":"Abstrct","children":[{"title":"Abstrct","children":[{"title":"JC.h <span style='color:#111;'> 265B </span>","children":null,"spread":false},{"title":"stdafx.cpp <span style='color:#111;'> 212B </span>","children":null,"spread":false},{"title":"stdafx.h <span style='color:#111;'> 318B </span>","children":null,"spread":false},{"title":"dllmain.cpp <span style='color:#111;'> 389B </span>","children":null,"spread":false},{"title":"targetver.h <span style='color:#111;'> 236B </span>","children":null,"spread":false},{"title":"Abstrct.cpp <span style='color:#111;'> 152B </span>","children":null,"spread":false},{"title":"Abstrct.h <span style='color:#111;'> 132B </span>","children":null,"spread":false},{"title":"Abstrct.vcxproj <span style='color:#111;'> 5.04KB </span>","children":null,"spread":false},{"title":"export.def <span style='color:#111;'> 39B </span>","children":null,"spread":false},{"title":"ReadMe.txt <span style='color:#111;'> 1.94KB </span>","children":null,"spread":false}],"spread":true},{"title":"Abstrct.sln <span style='color:#111;'> 888B </span>","children":null,"spread":false}],"spread":true},{"title":"1_DLLDemoCll","children":[{"title":"2_DLLDemo","children":[{"title":"stdafx.cpp <span style='color:#111;'> 214B </span>","children":null,"spread":false},{"title":"2_DLLDemo.vcxproj <span style='color:#111;'> 5.03KB </span>","children":null,"spread":false},{"title":"stdafx.h <span style='color:#111;'> 318B </span>","children":null,"spread":false},{"title":"dllmain.cpp <span style='color:#111;'> 389B </span>","children":null,"spread":false},{"title":"targetver.h <span style='color:#111;'> 236B </span>","children":null,"spread":false},{"title":"2_DLLDemo.h <span style='color:#111;'> 107B </span>","children":null,"spread":false},{"title":"2_DLLDemo.cpp <span style='color:#111;'> 446B </span>","children":null,"spread":false},{"title":"2_DLLDemo.def <span style='color:#111;'> 76B </span>","children":null,"spread":false},{"title":"ReadMe.txt <span style='color:#111;'> 1.95KB </span>","children":null,"spread":false}],"spread":true},{"title":"1_DLLDemoCll","children":[{"title":"stdafx.cpp <span style='color:#111;'> 217B </span>","children":null,"spread":false},{"title":"stdafx.h <span style='color:#111;'> 233B </span>","children":null,"spread":false},{"title":"targetver.h <span style='color:#111;'> 236B </span>","children":null,"spread":false},{"title":"2_DLLDemo.h <span style='color:#111;'> 66B </span>","children":null,"spread":false},{"title":"2_DLLDemo.dll <span style='color:#111;'> 38.00KB </span>","children":null,"spread":false},{"title":"1_DLLDemoCll.vcxproj <span style='color:#111;'> 4.32KB </span>","children":null,"spread":false},{"title":"1_DLLDemoCll.cpp <span style='color:#111;'> 1.02KB </span>","children":null,"spread":false},{"title":"ReadMe.txt <span style='color:#111;'> 1.55KB </span>","children":null,"spread":false}],"spread":true},{"title":"1_DLLDemoCll.sln <span style='color:#111;'> 1.34KB </span>","children":null,"spread":false}],"spread":true},{"title":"使用说明.txt <span style='color:#111;'> 788B </span>","children":null,"spread":false},{"title":"static_link_DLL","children":[{"title":"static_link_DLL.sln <span style='color:#111;'> 912B </span>","children":null,"spread":false},{"title":"static_link_DLL","children":[{"title":"JC.h <span style='color:#111;'> 265B </span>","children":null,"spread":false},{"title":"stdafx.cpp <span style='color:#111;'> 220B </span>","children":null,"spread":false},{"title":"stdafx.h <span style='color:#111;'> 233B </span>","children":null,"spread":false},{"title":"Abstrct.dll <span style='color:#111;'> 33.00KB </span>","children":null,"spread":false},{"title":"targetver.h <span style='color:#111;'> 236B </span>","children":null,"spread":false},{"title":"static_link_DLL.h <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"Abstrct.h <span style='color:#111;'> 132B </span>","children":null,"spread":false},{"title":"static_link_DLL.cpp <span style='color:#111;'> 304B </span>","children":null,"spread":false},{"title":"static_link_DLL.vcxproj <span style='color:#111;'> 4.46KB </span>","children":null,"spread":false},{"title":"Abstrct.lib <span style='color:#111;'> 1.76KB </span>","children":null,"spread":false},{"title":"ReadMe.txt <span style='color:#111;'> 1.57KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true}],"spread":true}]

评论信息

  • weixin_40707796 :
    啊 啊啊 啊 啊 啊
    2017-10-19
  • 兰亭旁者 :
    啊 啊啊 啊 啊 啊
    2017-10-19
  • u014571185 :
    直击我想解决的问题!太赞了,心目中·最理想的解决方法
    2017-07-10
  • 卡车cckk :
    直击我想解决的问题!太赞了,心目中·最理想的解决方法
    2017-07-10
  • sinat_22178547 :
    是使用方法,我看错了,还以为是制作动态库呢,不过验证时可以学习,谢谢!
    2017-04-18
  • 沐辰乐 :
    是使用方法,我看错了,还以为是制作动态库呢,不过验证时可以学习,谢谢!
    2017-04-18
  • qq_30228933 :
    谢谢分享了
    2016-11-16
  • ╭(╯3╰)╮ :
    谢谢分享了
    2016-11-16
  • shej2002 :
    然而并不是我要的。。。
    2016-11-02
  • shej2002 :
    然而并不是我要的。。。
    2016-11-02

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明