混合C / C ++库(Mixing C/C++ Libraries)

是否可以将gcc链接到使用Visual C ++创建的库? 如果是这样,这样做可能会产生任何冲突/问题吗?

Is it possible for gcc to link against a library that was created with Visual C++? If so, are there any conflicts/problems that might arise from doing so?

最满意答案

这里答案中的一些评论略显过于笼统。

虽然没有,但在特定情况下提到的gcc二进制文件不会与VC ++库(AFAIK)链接。 链接代码/库的实际方法是使用ABI标准的问题。

嵌入式领域越来越普遍的标准是EABI(或ARM ABI)标准(基于Itanium开发期间完成的工作http://www.codesourcery.com/cxx-abi/ )。 如果编译器符合EABI,则可以生成可以相互协作的可执行文件和库。 多个工具链协同工作的一个例子是ARM的RVCT编译器,它生成可与GCC ARM ABI二进制文件一起使用的二进制文件。

(代码源代码链接目前已关闭但可以谷歌缓存)

Some of the comments in the answers here are slightly too generalistic.

Whilst no, in the specific case mentioned gcc binaries won't link with a VC++ library (AFAIK). The actual means of interlinking code/libraries is a question of the ABI standard being used.

An increasingly common standard in the embedded world is the EABI (or ARM ABI) standard (based on work done during Itanium development http://www.codesourcery.com/cxx-abi/). If compilers are EABI compliant they can produce executables and libraries which will work with each other. An example of multiple toolchains working together is ARM's RVCT compiler which produces binaries which will work with GCC ARM ABI binaries.

(The code sourcery link is down at the moment but can be google cached)

更多推荐