21.4 windows_21_Library_use_DLL 动态库补充4

本文详细介绍了在Windows环境下如何使用DLL动态链接库,包括导入库文件、定义函数原型及调用DLL中的函数等步骤。通过具体示例展示了加法、减法和乘法函数的调用过程。
windows_21_Library_use_DLL  动态库补充4


   
  1. #include <iostream>
  2. using namespace std;
  3. //第2.1.1步 导入 lib
  4. #pragma comment(lib,"../debug/windows_21_Library_DLL_test.lib")
  5. //第2.1.2步 定义函数原型
  6. int Dll_Add( int nAdd1, int nAdd2 );
  7. extern "C"/*如果不加这个会出错*/ int Dll_Sub( int nSub1, int nSub2 );
  8. //DEF导出定义函数原型
  9. int Dll_Mul( int nMul1, int nMul2 );
  10. int main( )
  11. {
  12. //第2.1.3步 使用函数
  13. int nAdd = Dll_Add( 100, 100 );
  14. int nSub = Dll_Sub( 100, 100 );
  15. int nMul = Dll_Mul( 100, 100 );
  16. cout << nAdd << endl << nSub << endl << nMul << endl;
  17. }





转载于:https://www.cnblogs.com/nfking/p/5573275.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值