我正在尝试使用 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/