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


    一、导出相关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

  • 相关阅读:
    pycharm pip 源修改以及包管理(转载)
    zabbix在执行docker命令是报错
    ubuntu 14.04zabbix的安装
    docker搭建zabbix
    docker的安装
    docker registry v2与harbor的搭建
    docker常用命令
    centos安装桌面,下面的几个包缺一不可
    MSSQL数据库高版本迁移到低版本
    .NET开源MSSQL、Redis监控产品Opserver之Exception配置
  • 原文地址:https://www.cnblogs.com/onlyac/p/5346587.html
Copyright © 2020-2023  润新知