Windows桌面项目上的Win32 Lib [英] Win32 Lib on Windows Desktop Project
问题描述
我已经下载了第三方静态库并添加到我的Windows桌面项目中。
I have downloaded a Third-party Static Library and added into my Windows Desktop Project.
第三项 - 派对库是使用Win32创建的。我在我的C#项目中执行了DLLImport,但是当我尝试从库中调用方法时,它给出了以下错误。
The third-party library is created using Win32. I did DLLImport in my C# project, but when I try to call method from the library it gives me the below error.
- Message: "An attempt was made to load a program with an incorrect format"
- Exception: System.BadImageFormatException
我做了一个小小的研究,发现因为库是用32位操作系统它不能在64位操作系统上运行。
I did a small research and found that as the library was built using 32-bit OS it will not run on 64-bit OS.
我的电脑有Windows 8.1操作系统,64位。
My PC has Windows 8.1 OS, 64Bit.
有谁愿意放请注意这一点。
Would anyone like to put some light on this please.
谢谢
Somnath
推荐答案
您不能在64位应用程序中使用32位DLL,反之亦然。请参阅
MSDN 。
理想情况解决方案是拥有32位和64位版本的第三方DLL。
The ideal solution is to have both a 32-bit and a 64-bit version of your third-party DLL.
否则,您需要使用/ platform:x86而不是AnyCPU构建C#项目。
Otherwise, you need to build your C# project with /platform:x86 rather than AnyCPU.
这篇关于Windows桌面项目上的Win32 Lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!