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

來源:互聯網
上載者:User

總結:

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?

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.