how to locate dll in native c++ world / dotnet world?

总结:

1. 对于native c++ world来说,Dynamic-Link Library Search Order 说的很清楚了。就是还有一个疑问:如果在任意目录建立一新folder,把一个application需要的plugin之类的dll及dependency dlls都放在里面,在load这个plugin需要的dependency dlls时 (If a DLL with dependencies is loaded by specifying a full path, the system searches for the DLL's dependent DLLs as if they were loaded with just their module names.)这个新的folder会被search到吗?

2. 对于dotnet world,首先理解有两个application级的文件:app.exe.manifest, app.exe.config。 然后,关于runtime CLR如何locate assembly,这篇How the Runtime Locates Assemblies 是全面的介绍。The simple version is that the GAC is searched firstly, and then the app path tree. %PATH% is never used.  相关基础知识:

    1)In dotnet world, A private assembly is stored in the application’s directory and used by a single application. A share assembly can be used by multiple applications and is stored in the Global assembly cache, a repository of assemblies maintained by the .Net Framework.

    2)GAC 和sidebyside的区别,本blog里有详细介绍。

    3)如果你确实需要把一个app的private assembly(一定程度上算,但绝对算不是放在GAC里的资格)搬出app path来放,MS还提供了一套机制来帮助你定位assembly成功:AssemblyResolver。具体介绍,参见本blog AssemblyResolver。 

    4)use Assembly Binding Log Viewer (Fuslogvw.exe) to debug any assembly loading problems.

 

参考: In what order are locations searched to load referenced DLLs?

原文链接: https://www.cnblogs.com/taoxu0903/archive/2010/12/16/1908694.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    how to locate dll in native c++ world / dotnet world?

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/18848

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月7日 下午7:46
下一篇 2023年2月7日 下午7:46

相关推荐