Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
259 views
in Technique[技术] by (71.8m points)

c++ - Debug dll and doesn't contain the architecture x86_64

I build a 64-bit dll in Clion. Tollchain Visual Studio

Clion toolchain settings

The project compiles successfully. For debugging I use Win64 host application compiled in Delphi. I added this application in the configuration editor and when I start debugging I get the message

'Project.exe' doesn't contain the architecture x86_64
Process finished with exit code 0

The application itself without a debugger (or from under the Visual Studio debugger) starts and loads my dll.


Additional info

I have compiled an empty Delphi project

program Project1;

{$APPTYPE CONSOLE}

begin
end.

When I run it from under the debugger as a host application, I get the same error.

When running an empty project built in Visual Studio as an host application

int main()
{
}

the debugger starts without errors

Platform: Win64

For comparison PE Headers Delphi and VC programs

Delphi

enter image description here

enter image description here

Visual Studio

enter image description here

enter image description here

question from:https://stackoverflow.com/questions/65897450/debug-dll-and-doesnt-contain-the-architecture-x86-64

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

My guess is that Clion tests for the Machine Type flag in the COFF File Header. Unfortunately, I don't know of any built-in way in Delphi to set this value.

The best option would therefore be to create a tiny Delphi program that can set this value to the correct value

CONST IMAGE_FILE_MACHINE_AMD64 = $8664;

that you then execute as a post-build event.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...