码迷,mamicode.com
首页 > Windows程序 > 详细

21.2 windows_21_Library_Class_DLL_USE 动态库补充2

时间:2016-06-10 10:52:14      阅读:201      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!