0
A
回答
2
可以使用Assembly.LoadFrom
方法加載的組件。從這裏您可以使用reflection來調用庫的公共方法。
0
你的問題沒有給出更多關於請求性質的上下文,但是如果你想爲插件類型的可擴展性原因加載程序集,那麼我建議使用像MEF(託管擴展性框架)這樣的庫。有使用MEF with Delphi Prism here一個簡短的帖子,但它可以讓你定義一個接口,並在許多不同的方式使用你的組件:
首先,你應該定義你的接口:
PluginList = class
public
[ImportMany(typeof(IFileAction))]
property FileActions: IList<IFileAction> read write;
constructor;
end;
然後你就可以加載最多延期儘可能多的組件,你在許多不同的方式祝願:
var aggregateCat := new AggregateCatalog();
var catalogThisAssembly := new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly());
var catalogIndividual := new AssemblyCatalog('plugins\MyHelloPlugin.dll');
var dirCatalog := new DirectoryCatalog('plugins');
// Add our Catalogs here,
aggregateCat.Catalogs.Add(dirCatalog);
var container := new CompositionContainer(aggregateCat);
// Create our plugin hosting object
var pluginList := new PluginList();
// Compose the parts.
container.ComposeParts(pluginList);
然後,您有加載的程序集列表時,你可以執行你的行動:
for each plugin: IFileAction in pluginList.FileActions do
begin
Console.WriteLine('Loaded ' + plugin.Name + ', version ' + plugin.Version);
end;
相關問題
- 1. 有沒有辦法在Android中關閉動態加載的庫?
- 2. 有沒有辦法在Blue Prism中「激活」html應用程序?
- 3. 有沒有辦法不加載jQuery?
- 4. 有沒有辦法在python中重載+ =?
- 5. 有沒有辦法強制加載器在固定地址加載共享庫?
- 6. 有沒有辦法在Apache中預加載代碼在PHP中?
- 7. 有沒有辦法在Delphi中搜索OvcViewrof TurboPower Orpheus中的TOvcFileViewer
- 8. 有沒有辦法讓PyCharm代碼完整的CDN加載庫?
- 9. 有沒有辦法重新加載主GEPlugin數據庫?
- 10. 有沒有辦法使用Resque動態加載Ruby庫?
- 11. 有沒有辦法在Delphi中修改FD_SETSIZE(WinSock)的值?
- 12. 有沒有辦法在.dll文件中存儲Delphi窗體?
- 13. 有沒有辦法在Delphi中記錄每一個gui事件?
- 14. 有沒有辦法在Delphi中顯示垂直縮進線?
- 15. 有沒有辦法在java中加載gz文件?
- 16. 在Chef中,有沒有辦法從子目錄加載屬性?
- 17. 有沒有辦法在javaFX中加載Eclipse RCP插件?
- 18. 有沒有辦法在Wordpress中異步加載腳本?
- 19. 有沒有辦法在ImageView中加載全景光球?
- 20. 有沒有辦法在compojure中進行熱重新加載?
- 21. 有沒有辦法在內存中加載多個app.configs?
- 22. 有沒有辦法在Perl中加載配置文件?
- 23. 有沒有辦法在Chrome擴展中加載一個applet?
- 24. 有沒有辦法在crm中簡單加載記錄?
- 25. 有沒有辦法在JVM中查找加載的類文件?
- 26. 有沒有辦法在Python中重新加載「當前」文件?
- 27. 加載jQuery的,如果沒有加載 - 沒辦法
- 28. 有沒有辦法從iOS中的plist中加載const unsigned char?
- 29. 有沒有辦法在UIWebview
- 30. 有沒有delphi winsock2庫?