Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm having a problem, I've been trying to solve it since yesterday but no luck. I have a 32-bit Delphi DLL which I want to import it in to a .NET WIN Application. This application has to be built on ANY CPU mode. Of course, the exception BadImageFormatException is thrown, which means that 64-bit applications can't load x86 DLLs. I googled around and found a solution, it said that I have to do wrapper, but it wasn't clear for me. Can anyone tell me how to solve this problem, is there any possible way that I can import a 32-bit Delphi DLL in to a program built under any CPU architecture (64-bit, 32-bit) or maybe another solution?

See Question&Answers more detail:os

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

1 Answer

What you have to do is write a wrapper application that hosts the 32-bit DLL file, in a 32-bit process.

Your 64-bit application then has to talk to this 32-bit process, through network means, or by making the DLL functions available through a COM object, or similar.

You can not run a 32-bit DLL inside a 64-bit process, no matter how hard you try, so you need to run it in a 32-bit process.

If compiling your application for 32-bit only is not an option, you have no choice but to create a host application.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...