LLVM和Visual Studio .obj二进制不兼容 [英] LLVM and visual studio .obj binary incompatibility

查看:98
本文介绍了LLVM和Visual Studio .obj二进制不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否为Visual Studio组合的.obj和静态.lib文件计划了LLVM二进制兼容性吗? 现在,我只能将LLVM制成的.obj文件与动态库链接,该动态库会在运行时加载DLL(从Visual Studio编译).

Does anyone know if LLVM binary compatibility is planned for visual studio combiled .obj and static .lib files? Right now I can only link LLVM made .obj files with dynamic libs that loads a DLL at runtime (compiled from visual studio).

虽然在两个编译器之间发生二进制兼容性的可能性很小,但是没有人知道为什么对于一个平台的编译器之间很难做到这一点吗?

While there probably is very small chances that binary compatibility will happen between the two compilers, does anybody know why it is so difficult achieving this between compilers for one platform?

推荐答案

正如Neil所说,兼容性包括诸如调用约定,名称修饰等内容.尽管这两个是最小的问题. LLVM已经知道所有特定于Windows的调用约定(stdcall,fastcall,thiscall),这就是为什么您可以从.dll调用内容的原因.

As Neil already said, the compatibility includes stuff like calling convention, name mangling, etc. Though these two are the smallest possible problems. LLVM already knows about all windows-specific calling conventions (stdcall, fastcall, thiscall), this is why you can call stuff from .dll's.

如果我们谈论C ++代码,则主要问题是C ++ ABI:vtable布局,rtti实现等.clang遵循Itanium C ++ ABI(例如gcc使用其他方法),VCPP-不会,所有这些不幸的是没有证件.在这个方向上有一些工作正在进行,所以东西可能显然开始起作用.请注意,很可能某些部分将永远不会被覆盖,例如在Win32上基于seh的异常处理,因为它已获得专利.

If we speak about C++ code then the main problem is C++ ABI: vtable layout, rtti implementation, etc. clang follows Itanium C++ ABI (which gcc use, for example, among others), VCPP - doesn't and all these are undocumented, unfortunately. There is some work going in clang in this direction, so stuff might start to work apparently. Note that most probably some parts will never be covered, e.g. seh-based exception handling on win32, because it's patented.

与纯C代码的链接使用了很长时间,因此,您可以通过C存根/包装程序解决与C ++ ABI有关的问题.

Linking with pure C code worked for ages, so, you might workaround these C++ ABI-related issues via C stubs / wrappers.

这篇关于LLVM和Visual Studio .obj二进制不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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