64位WIN7下C#调用C++编写的动态库出现0x8007000B错误
dsc 2011-08-09 11:52:37 动态库是用VS2008 VC++编写,分别有64位版本和32位版本,上层应用程序用VS2008 C#编写,如果目标平台设置为x64,在Windows 7 64位系统中,应用程序调用64位的动态库时没有问题,如果目标平台设置为x86,在Windows XP/7 32位系统中,应用程序调用32位的动态库时也没有问题。
但由于上面的调用时C#应用程序要分别单独编译,为了统一为一个版本,将目标平台设置为AnyCPU,在Windows 7 64位系统时运行时,出现了异常对话框,对话框中内容如下:
Unhandled exception has occurred in your application. If you click Continue, the application will ignore the error and attempt to continue. If you click Quit, the application will close immediately.
An attempt was made to load a program with an incorrect format.
(Exception from HRESULT: 0x8007000B).
无论点击Continue还是Quit按钮,应用程序都异常退出。
请问出现此问题的原因是什么?如何解决此问题?
如果分不够,可以再开贴加分。