Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
The community reviewed whether to reopen this question 2 years ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
不要从 C++ 标准中寻找所有答案。
C++ 标准没有定义由不同编译器编译的目标模块链接在一起时的行为。 C++ 标准的管辖范围仅限于其创建者选择遵守 C++ 标准的单个 C++ 实现。
应用程序二进制接口 (ABI) 涵盖了将不同对象模块链接在一起的情况。如果您使用两个都符合相同 ABI 的编译器编译两个函数,并使用符合 ABI 的链接器链接它们,那么它们通常应该一起工作。还有其他细节需要考虑,例如语言中的各种事物如何绑定到 ABI 中的相应事物。例如,一个编译器可能将
long
映射到 ABI 中的某个 32 位整数类型,而另一个编译器可能将long
映射到某个 64 位整数类型,这将当然,除非做出相应的调整,否则会干扰协同工作的功能。Do not look to the C++ standard for all your answers.
The C++ standard does not define the behavior when object modules compiled by different compilers are linked together. The jurisdiction of the C++ standard is solely single C++ implementations whose creators choose to conform to the C++ standard.
Linking together different object modules is covered by an application binary interface (ABI). If you compile two functions with two compilers that both conform to the same ABI and link them with a linker that conforms to the ABI, they generally should work together. There are additional details to consider, such as how various things in the language(s) bind to corresponding things in the ABI. For example, one compiler might map
long
to some 32-bit integer type in the ABI while the other compiler might maplong
to some 64-bit integer type, and this would of course interfere with the functions working together unless corresponding adjustments were made.