在64位系统上使用32位dll显示0x8007000B错误 [英] Using 32-bit dll on 64-bit system shows 0x8007000B Error

查看:1411
本文介绍了在64位系统上使用32位dll显示0x8007000B错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在我的应用程序中使用第三方DLL。 DLL是32位,我使用的系统是64位操作系统。



我已经在我的DotNet应用程序(framework-4.5)中导入了32位DLL,如下所示:

  [DllImport(Sample.dll,
EntryPoint =Add,
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern int Add(int iA,int iB);

在IIS 7.5中 - 我已将启用32位应用程序设置为 p>

并尝试将编译器管理器设置为 - X86,x64和任何CPU。



但是所有的尝试结果与

相同的错误

 尝试加载格式不正确的程序。 (来自HRESULT的异常:0x8007000B)

如何解决此问题......

解决方案

我遇到了这个问题,当我在64位机器上运行32位dll和使用DllImport方法时,忘记安装适当的可再发行库,为我所打电话。我需要安装可视化c + +可重新分发的时候,一个被调用的库有依赖于这一点,我还需要安装英特尔Visual Fortran可再发行组件 - 当从.NET库调用Fortran函数。


I have to use a third party DLL in my application. The DLL is a 32-bit and the system I am using is 64-bit OS.

I have Imported the 32-bit DLL in my DotNet application (framework-4.5) as below

 [DllImport("Sample.dll",
  EntryPoint = "Add",
  CharSet = CharSet.Ansi,
  CallingConvention = CallingConvention.StdCall)]
  public static extern int Add(int iA, int iB);

In IIS 7.5 - I have set "Enable 32-bit Application" as "True".

And also tried setting the Compiler Manager as - X86, x64 and Any CPU.

But all the attempt results in same Error as

 An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

How to resolve this Issue......

解决方案

I have experienced this problem both when I was running a 32-bit dll on a 64-bit machine and when using the DllImport method and forgetting to install the appropriate redistributable library for what I was calling. I've needed to install the visual c++ redistributable on occasion when a called library had a dependency on that and I've also needed to install the Intel Visual Fortran redistributable - when calling a Fortran function from a .NET library.

这篇关于在64位系统上使用32位dll显示0x8007000B错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆