mingw DLL to MSVC libs using cmake

1.  Generate makefile by cmake
     cmake -G "MSYS Makefiles" -DBUILD_SHARED_LIBS=ON

In msys bash do follows
2.  Compile in mingw
      make
which would generate dll library XXX.dll
3.  Generate def file
     gendef XXX.dll

In VS command prompt do follows
4. Generate MSVC library
    lib /machines:x64 /def:XXX.def /out:XXX.lib


A MSVC dll file could also be transfered into mingw .a file
1. Generate def file
    gendef  XXX.dll
2. Generate .a library
    dlltool --dllname XXX.dll --input-def XXX.def --output-lib libXXX.a

没有评论:

发表评论

VS Code下cmake, c++编译,调试环境的构成步骤

1   下载必须extension      按[Ctrl+Shift+X]打开extension窗口,选择安装"C/C++", "CMake", "CMake Tools" 2   在VSCode下打开作业目录 ...