NET.disableAutoRelease
锁定表示运行时可调用包装器(COM 包装器)的 .NET 对象
说明
NET.disableAutoRelease(
锁定表示运行时可调用包装器(COM 包装器)的 .NET 对象,以阻止 MATLAB® 释放 COM 对象。正常使用对象之后,调用 obj
)NET.enableAutoRelease
释放 COM 对象。
示例
锁定 COM 包装器对象
假设用户定义函数 GetComApp.m
可访问伪类 ComNamespace.ComClass
中定义的 COM 对象。其中一个方法是 readData
,带有以下签名:
System.String RetVal readData(ComNamespace.ComClass this, System.String strIn)
输入参量在伪类 NetDocTest.MyClass
中定义,该类有一个名为 MyApp
的属性。
function GetComApp(obj) comObj = ComNamespace.ComClass; obj.MyApp = comObj; % To pass a COM object to another process, lock the object NET.disableAutoRelease(comObj); end
NET.enableAutoRelease
中的示例显示如何调用 GetComApp
函数。
输入参数
obj
— 表示 COM 包装器的 .NET 对象
COM 包装器类
表示 COM 包装器的 .NET 对象,指定为 COM 包装器类对象。
示例: ComNamespace.ComClass
版本历史记录
在 R2010b 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)