Share via


call_as

允许将本地函数映射到远程函数,以便在调用远程函数时调用本地函数。

语法

[ call_as(function) ]

参数

函数
调用远程函数时要调用的本地函数。

备注

call_as C++ 特性具有与 call_as MIDL 特性相同的功能

示例

以下代码演示如何使用 call_as 将不可远程处理的函数 (f1) 映射到可远程处理的函数 (Remf1)

// cpp_attr_ref_call_as.cpp
// compile with: /LD
#include "unknwn.h"
[module(name="MyLib")];
[dual, uuid("00000000-0000-0000-0000-000000000001")]
__interface IMInterface {
   [local] HRESULT f1 ( int i );
   [call_as(f1)] HRESULT Remf1 ( int i );
};

要求

特性上下文
适用于 接口方法
可重复
必需的特性
无效的特性

有关特性上下文的详细信息,请参见 特性上下文

另请参阅

IDL 特性
方法特性
local