I am working on one migration project from x32
bit to x64
.
Here I am using this code:
{$L com_1.obj}
{$L com_is1.obj}
{$L com_2.obj}
But while compiling code I am getting error as
[dcc64 Error] XXX.dpr(919): E2045 Bad object file format: 'E:\MyProj\com_sha.obj'
I am not able to trace why it is happening.
Is it due to 32 bit obj file used for compiling x64 bit delphi project?
If it is I have also tried to create a obj file with x64 bit environment.
Can anyone please help me on this?
I am using Delphi 10 Seattle
.
You cannot use a 32 bit object with the 64 bit compiler. You must recompile your code with a 64 bit compiler.
You can use a number of different compilers to do this. Although I have heard of people succeeding with gcc I have never managed to do that. I believe that the modern Clang based Embarcadero compiler can be used, but I personally have no experience of that. I have always used the Microsoft compiler to create 64 bit objects. And certainly this is how Embarcadero themselves have done it for libraries like zlib that they link to their RTL.
Yes you need to convert those .obj
files to 64 bit.
Converting 32-bit Delphi Applications to 64-bit Windows states:
- 64-bit External .obj Files: If you expect your 64-bit Windows application to link to an external .obj file, keep in mind that you will need a 64-bit version of the .obj file to link with a 64-bit Windows application.