c# - 64 位进程 Vista 中的 64 位 dll 失败 - 无法加载 DLL 'dllname' : The specified module could not be found

标签 c# c++ visual-studio-2008 visual-c++ dll

我有一个 native C 代码,我在 vc++ 2008 中编译代码,并在配置管理器中使用“x64”作为平台编译,我有一个 c# 应用程序,它也使用“x64”作为平台编译,它调用 dll功能。我已经使用 Dllimport 从 dll 调用函数,如下所示。

using System.Runtime.InteropServices;

namespace test            
{    
public partial class Form1 : Form                                                     
  {

      [DllImport("mtest", CharSet = CharSet.Ansi)]
        public extern static void e_path(string path);

        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("test");
            swe_set_ephe_path("E:\\Gan");
        }
    }
}

在运行应用程序时出现如下错误:

test.exe 中发生类型为“System.DllNotFoundException”的未处理异常

附加信息:无法加载 DLL“mydll”:找不到指定的模块。 (HRESULT 异常:0x8007007E)

请问您能帮我解决这个问题吗?如果我同时运行 dll 和应用程序,它工作正常。但是我需要从我的 ASP 页面调用 dll 函数,所以我需要 64 位的 dll 和应用程序。

附加信息:当我使用 64 位依赖项 walker 检查 dll 的依赖项时,它显示 Kernel32.dll 和 NTDLL.DLL 以及 mydll.dll 是 x64。

请帮我解决这个问题。

提前致谢

最佳答案

在 x64 平台上,SYSWOW64 目录包含 32 位应用程序的文件。 您会在注册表中发现相同的区别,其中 SYSWOW64 包含 x32 应用程序的条目。 问候

注释:包含32位条目的注册表项是Wow6432Node,驻留在//HKEY_LOCAL_MACHINE

关于c# - 64 位进程 Vista 中的 64 位 dll 失败 - 无法加载 DLL 'dllname' : The specified module could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/949000/

相关文章:

c# - 将事件处理程序的定义作为 lambda 表达式传递

c++ - 在同一台计算机上运行多个版本的 OpenCV

c++ - isnan 在分配给不同大小的 FP 类型时保留。

visual-studio - 为什么总是从源代码管理中自动 check out vwd.webinfo?

c - 调试时查看源代码的宏扩展版本

c# - AppDomain,运行程序集 .exe 或 .dll?

c# - 从 xml 加载对象,在动态 UI 中编辑值并保存回 xml

c# - 将 SAXON 9.5 (nuget) 与 Schematron 结合使用

c# - 在MVVM Light中使用ViewModel?

c++ - lambda 中引用捕获的对象的类型