Compatibility of *.dll *.a *.lib *.def between VisualStudio and gcc

后端 未结 4 1836
广开言路
广开言路 2020-12-29 05:15

this is very confusing. I spent a lot of time reading posts on this on stack, etc. Still confused.

I am using Qt and C++ for coding. In Qt, I am using the gcc optio

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 06:15

    I stumbled upon this question when searching for the tool to use to create the .a file using Code::Blocks c++ compiler for windows. Code:Blocks uses MinGW gcc compiler. It was high enough on google to validate my necromancy I think.

    Dynamic link libraries (dll's) are a mixed bunch. Some can be compiled in a way that makes them very hard to use outside the programming language and compiler they were created with.

    Often however the dll is created with a clean C interface. When that is the case the answers to your questions that I think I can answer is:

    1: that's not a question.

    2, 9: yes

    3, 10: no

    4, 11: yes. MinGW includes a tool (dlltool.exe) that takes a .dll and a .def file and creates a .a file MS VisualStudio also includes a tool (that I think is called lib.exe) to do the same thing. And if you start using another compiler you will probably find they have a tool too. Borlands compilers had the implib.exe tool.

    5, 12: yes (same as 4)

    6, 13: pew... I don't think there is an expiration date on dll's but they must be compiled for the right operating system.

    8, 16: you need the .def to make the .a or .lib, if you don't have it, it is actually posible to create that from the .dll

提交回复
热议问题