简体   繁体   中英

DllImport can't find dll even though dll is in same folder as executable

I'm trying to use the llvm-fs project, which provides llvm bindings for F#. I have compiled the LLVM-3.1.dll file with --enable-shared and it now resides in same directory as my compiled executable (I checked with Environment.CurrentDirectory ). The DllImport in llvm-fs looks like:

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

Yet when I run my application it errors with:

Unable to load DLL 'LLVM-3.1.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)

How do I get the DLL to be loaded? For reference, here's the exact DLL I'm trying to load .

This:

"The specified module could not be found"

can point to some library, which LLVM-3.1.dll depends from, not the LLVM-3.1.dll itself.

当DLL或EXE无法加载时, Depends.exe非常方便 - 它显示完整的EXE / DLL依赖树,突出显示无法加载或丢失的内容。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM