处置导入的D​​LL [英] Dispose a imported DLL

查看:65
本文介绍了处置导入的D​​LL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,我使用DllImport("OTVPlayer.dll")]及其方法导入DLL.使用后如何处置此DLL?请帮忙.非常紧急的

In my code im importing a DLL using DllImport("OTVPlayer.dll")] and using its methods. How can I dispose this DLL after using? Please help. very urgent

推荐答案

在.NET中,除非卸载所有AppDomain,否则无法卸载模块/组件.卸载程序集时应释放不受管的库.

尝试创建一个新的AppDomain,完成您的工作,并在完成后将其卸载.我知道这不好.
In .NET you cannot unload modules/assemblies unless you unload all AppDomain. The unamanaged libraries should be released when calling assembly is unloaded.

Try to create a new AppDomain, do your stuff and when you finish, unload it. It''s not nice, I know.


这篇关于处置导入的D​​LL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆