在由g ++(mingw)编译的应用程序中使用Visual Studio编译的库 [英] Use libraries compiled with visual studio in an application compiled by g++ (mingw)

查看:379
本文介绍了在由g ++(mingw)编译的应用程序中使用Visual Studio编译的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Windows上使用由g ++(mingw)编译的应用程序中由visual studio编译的库?

Is it possible to use a library compiled by visual studio in an application compiled by g++ (mingw) on Windows?

推荐答案


  • 如果库是用C ++编写的,并且暴露了一个C ++接口:no(因为g ++和VC ++之间名称不同)。

    • If the library is written in C++ and exposes a C++ interface: no (because the name-mangling differs between g++ and VC++).

      如果库是使用C语言编写的静态库(或使用 externC接口):是,但某些注意事项适用

      If the library is a static library written in C (or with an extern "C" interface): yes, but certain caveats apply.

      如果库是具有C接口的DLL:是的,但您必须创建您的自己的导入库

      If the library is a DLL with a C interface: yes, but you'll have to create your own import library.

      这篇关于在由g ++(mingw)编译的应用程序中使用Visual Studio编译的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆