zoukankan      html  css  js  c++  java
  • vc写的dll被mingw的g++编译引用

    dll.cpp,用vc2017编译

    #include <iostream>
    #include <windows.h>

    extern "C" __declspec(dllexport) void Go() {
      std::cout << "go" << std::endl;
    }

    BOOL APIENTRY DllMain( HMODULE hModule,
    DWORD ul_reason_for_call,
    LPVOID lpReserved
    )
    {
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
    break;
    }
    return TRUE;
    }

    main.cpp 用mingw64的g++编译

    #include <iostream>

    extern "C" __declspec(dllimport) void Go();
    int main (int argc, char **argv)
    { 

      Go();
      return 0;
    }

    将dll.lib dll.dll dll.exp dll.pdb复制到main.cpp当前目录,编译:

    g++ main.cpp -ldll -L.

  • 相关阅读:
    路由器的配置
    逻辑卷
    valn配置
    交换分区和虚拟内存
    TCP和UDP
    语法练习1
    oracl通用函数
    AOP
    oracle查询操作
    Oracle中的转换函数
  • 原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/9101306.html
Copyright © 2011-2022 走看看