Where does DLLImport look for unmanaged DLLs?

2019-02-12 16:49发布

A quick question: When declaring the DLLImport Attribute in .Net, where does the runtime look to resolve that DLL dependency? Would I have to dump the DLL and all of its dependencies in the bin folder?

2条回答
Root(大扎)
2楼-- · 2019-02-12 17:38

I think it is working like LoadLibrary.

Maybe Windows path searching in LoadLibrary with manifest will be helpfull.

Edit Dynamic-Link Library Search Order is probably what you want.

查看更多
对你真心纯属浪费
3楼-- · 2019-02-12 17:41

Generally, you'd expect it to look at whatever's defined in the user's Path.

To find out what this contains, from a command prompt, type echo %PATH% [Enter]

查看更多
登录 后发表回答