Where does DLLImport look for unmanaged DLLs?

橙三吉。 提交于 2020-01-10 18:54:07

问题


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?


回答1:


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.




回答2:


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]



来源:https://stackoverflow.com/questions/268627/where-does-dllimport-look-for-unmanaged-dlls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!