码迷,mamicode.com
首页 > 其他好文 > 详细

生成读取相关连接的物理地址的lib(动态导入库)和dll(动态链接库)

时间:2016-04-01 23:28:40      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:

一、导出相关dll库

将原先的CmdInfoToPipe.h class后加入关键字 __declspec(dllexport)

 1 #ifndef NETINFO_CMDINFOTOPIPE_H_
 2 #define NETINFO_CMDINFOTOPIPE_H_
 3 #include <windows.h>
 4 #include <stdio.h>
 5 #include <string>
 6 #include <vector>
 7 
 8 class __declspec(dllexport) CmdInfoToPipe
 9 {
10 public:
11     CmdInfoToPipe();
12     ~CmdInfoToPipe();
13     DWORD getCmdInfo(char *cmd);
14     std::vector<std::string> get_Mac_Address(std::string strconnect = "本地连接", std::string straddress = "物理地址");
15 private:
16     std::string strcmd_;
17     std::string cmd_;
18 };
19 #endif//CmdInfoToPipe.h

1. 出现宽字符编译问题,设置properties->general->character set->use multi-byte character set

2. 导出相应的库,设置properties->general->configuration type->dynamic libaray(.dll)

3. 编译生成,即在Debug文件夹中生成相关文件

4. 未解决问题:还有两个warning:关于两个成员变量的

二、测试相关的dll库

测试代码类似

1.添加相应的环境变量。

2.在测试项目中的properties->VC++ Directories添加相应的include和lib Directories

3.在测试项目中的properties->C/C++->general->additional include directories添加相应的include Directories

4.在测试项目中的properties->Linker->general->additional libaraydirectories添加相应的libDirectories

5.在测试项目中的properties->Linker->Input->additional Dependencies添加相应的lib

生成读取相关连接的物理地址的lib(动态导入库)和dll(动态链接库)

标签:

原文地址:http://www.cnblogs.com/onlyac/p/5346587.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!