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

前端 未结 2 1877
不知归路
不知归路 2020-12-08 22:40

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?

相关标签:
2条回答
  • 2020-12-08 23:26

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

    0 讨论(0)
  • 2020-12-08 23:27

    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.

    0 讨论(0)
提交回复
热议问题