首页 > Windows开发 > 详细

21.2 windows_21_Library_Class_DLL_USE 动态库补充2

时间:2016-06-10 10:49:41      阅读:209      评论:0      收藏:0      [点我收藏+]

windows_21_Library_Class_DLL_USE 动态库补充2

  1. // windows_21_Library_Class_DLL_USE.cpp : 定义控制台应用程序的入口点。
  2. //
  3. #include "stdafx.h"
  4. //导入DLL文件
  5. #pragma comment(lib,"../bin/windows_21_Library_Class_DLL.lib")
  6. //需要声明一个类的定义,还需要导入类__declspec( dllimport )
  7. class __declspec( dllimport )CMath
  8. {
  9. public:
  10. int Add( int nAdd1, int nAdd2 );
  11. int Sub( int nSub1, int nSub2 );
  12. };
  13. int _tmain(int argc, _TCHAR* argv[])
  14. {
  15. //使用类
  16. CMath math;
  17. int nAdd = math.Add( 100, 100 );
  18. int nSub = math.Sub( 100, 100 );
  19. printf( "nAdd:%d\nnSub:%d\n", nAdd, nSub );
  20. return 0;
  21. }





21.2 windows_21_Library_Class_DLL_USE 动态库补充2

原文:http://www.cnblogs.com/nfking/p/5573266.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!