64 位 Delphi 目标能否静态链接到已编译的 C 对象文件? [英] Can 64 bit Delphi targets statically link to compiled C object files?

查看:29
本文介绍了64 位 Delphi 目标能否静态链接到已编译的 C 对象文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 32 位 Delphi 2010 应用程序使用 $LINK 编译器指令链接到许多 C 对象文件.以 64 位为目标时,我可以在 Delphi XE2 中执行此操作吗?

My 32 bit Delphi 2010 application links to a number of C object files using the $LINK compiler directive. Can I do this in Delphi XE2 when targetting 64 bit?

我目前正在使用 bcc32 5.5 版进行编译,但如果结果证明 Embarcadero C 编译器尚未输出 64 位对象,我不介意我使用哪个编译器.

I am currently compiling using bcc32 version 5.5, but I don't mind which compiler I use if it turns out that the Embarcadero C compiler does not yet output 64 bit objects.

推荐答案

是的.您必须将C"对象文件编译为 COFF 格式.这通常意味着 Intel 和/或 MSVC++ 编译器.相同的警告适用于适用于 32 位的 64 位目标文件链接.您必须确保正确解析所有外部引用,方法是提供另一个具有该符号的 .obj,或者来自 Delphi 代码.构建C"代码时,请确保禁用任何堆栈检查或其他运行时验证代码生成.很多时候,此类代码生成依赖于给定工具中特定版本的 C/C++ RTL.

Yes. You must compile the "C" objects files to COFF format. This usually means either the Intel and/or MSVC++ compilers. The same caveats apply to 64bit object file linking that apply to 32bit. You must ensure that all external references are properly resolved, either by providing another .obj which has that symbol, or from Delphi code. When building the "C" code, make sure you disable any stack checks or other run-time verification code generation. Many times such codegen relies on a specific version of the C/C++ RTL from the given tool.

还有一点值得注意的是,虽然 Delphi 64 位可以链接到 COFF 对象文件(最终它也将支持 ELF64),但 32 位 Delphi 支持链接到 C++Builder 构建的 OMF 对象文件,新的到 XE2,可以用 MSVC++ 构建的 32 位 COFF 目标文件.同样的警告也适用.

Something else worth noting is that while Delphi 64bit can link to COFF object files (eventually it will also support ELF64), 32bit Delphi supports linking with C++Builder built OMF object files and, new to XE2, 32bit COFF object files which can be built with MSVC++. The same caveats apply.

这篇关于64 位 Delphi 目标能否静态链接到已编译的 C 对象文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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