作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 C++ DLL 中有以下代码。它在使用 C# 构建的 DotNet DLL 中加载和调用方法。
Assembly^ a = Assembly::LoadFrom(gcnew String("MyDotNet.dll"));
Type^ type = a->GetType("MyAssemply.Assembly");
MethodInfo^ method = type->GetMethod("MyMethod");
Object^ obj = Activator::CreateInstance(type);
array<Object^>^ params = gcnew array<Object^>(0) { };
Object^ ret = method->Invoke(obj, params);
问题是,即使我在 C++ DLL 上执行 FreeLibrary,它似乎也没有释放资源或 DLL。是否需要调用 API 或方法来释放 DLL/资源?
我正在使用 Visual Studio 2010。
谢谢。
最佳答案
您不能从应用程序池中卸载托管程序集。您可以创建另一个应用程序池并卸载它。
这篇文章是相关的:How to unload an assembly from the primary AppDomain?
关于c++ - 如何释放在 C++ 中加载的 DotNet 程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13766400/
我是一名优秀的程序员,十分优秀!