开发者

Can 64 bit Delphi targets statically link to compiled C object files?

开发者 https://www.devze.com 2023-04-01 16:13 出处:网络
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?

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?

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.


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.

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.


Yes, you can link to OBJ files in 64-bit XE2 projects, but the OBJ files have to be 64-bit code.

0

精彩评论

暂无评论...
验证码 换一张
取 消