.net - 即使 dll 与可执行文件位于同一文件夹中,DllImport 也找不到 dll

标签 .net f# llvm dllimport llvm-fs

我正在尝试使用 llvm-fs项目,它为 F# 提供 llvm 绑定(bind)。我已经编译了LLVM-3.1.dll带有 --enable-shared 的文件它现在与我编译的可执行文件位于同一目录中(我检查过 Environment.CurrentDirectory )。 DllImport在 llvm-fs 中看起来像:

[<DllImport(
    "LLVM-3.1.dll",
    EntryPoint="LLVMModuleCreateWithName",
    CallingConvention=CallingConvention.Cdecl,
    CharSet=CharSet.Ansi)>]
extern void* (* LLVMModuleRef *) moduleCreateWithNameNative(string ModuleID)

然而,当我运行我的应用程序时,它会出错:
Unable to load DLL 'LLVM-3.1.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)

如何获取要加载的 DLL?供引用,here's the exact DLL I'm trying to load .

最佳答案

这:

"The specified module could not be found"



可以指向某个库,LLVM-3.1.dll取决于,而不是 LLVM-3.1.dll本身。

关于.net - 即使 dll 与可执行文件位于同一文件夹中,DllImport 也找不到 dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12191702/

相关文章:

c# - c#中的方法锁

c# - 线程.BeginThreadAffinity

F# 与 OCaml : Stack overflow

c++ - 为什么 p &key3 + 2 和 p (int*)&key3 + 2 在 LLVM 中会打印不同的结果?

c# - 在 C# 中确定 SQL 查询参数的数据类型

F# 使用 monad (ROP) 来组合具有两个参数的函数

f# - seq.nth 和 seq.item 有什么区别?

c - 如何从给定 LLVM IR 的源代码中获取变量的所有行号?

c++ - 如何使用 clang::TreeTransform?

c# - 手动 Windows 身份验证