32 bit dll importing in 64 bit .Net application

后端 未结 5 2029
天涯浪人
天涯浪人 2020-12-30 10:24

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 ap

5条回答
  •  时光取名叫无心
    2020-12-30 10:55

    As I understand things, you have no way of using a 32-bit DLL from a 64-bit application. That said, you may compile your application for X86 only.

    The solution you found may be about how to use a DLL that exists for both 32- and 64-bit versions in an "Any CPU"-compiled project depending on whether the application is running in a 32- or 64-bit environment.

    To do that, you could write two wrapper DLLs in C#, one for 64-bit and one for 32-bit and use the respective wrapper depending on whether you're running on a 64-bit or 32-bit OS.

    However, this does not work when all you have is a 32-bit DLL. A 64-bit application can not use 32-bit DLLs, as well as a 32-bit application can not use 64-bit DLLs.

    So you either need to compile your application for 32-bit, or you have to create a 64-bit version of your DLL.

提交回复
热议问题