如何在ASP.NET Web应用程序中卸载C ++ DLL? [英] How to unload a C++ DLL in ASP.NET Web Application?

查看:109
本文介绍了如何在ASP.NET Web应用程序中卸载C ++ DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用DLLImport加载C ++ DLL,但是现在我发现没有直接方法可以卸载DLL.如果是这样,该方法将无法刷新参数,从而导致逻辑错误.

I use DLLImport to load a C++ DLL, but now I find that there is not a direct method to unload the DLL. If so, the method cannot refresh the parameters,leading to a logical error.

推荐答案

您可以使用以下调用来加载/卸载库:

You can use these calls to load/unload libraries:

[DllImport("kernel32.dll")]
protected internal static extern IntPtr LoadLibrary(string dllToLoad);

[DllImport("kernel32.dll")]
protected internal static extern bool FreeLibrary(IntPtr hModule);



也是有用的:



And also useful:

[DllImport("kernel32.dll")]
private static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);


这篇关于如何在ASP.NET Web应用程序中卸载C ++ DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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