共用方式為


call_as

可讓本機會對應至遠端函式,因此呼叫遠端函式時,要叫用本機的函式的函式。

[ call_as(
   function
) ]

參數

  • Function - 功用
    您想要呼叫遠端函式叫用時本機函式。

備註

Call_as C++ 屬性具有相同的功能,為 call_as MIDL 屬性。

範例

下列程式碼將示範如何使用 call_as ,將對應的 nonremotable 函式 (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 ); 
};

需求

屬性內容

適用於

介面方法

可重複

必要的屬性

None

無效的屬性

None

如需有關屬性內容的詳細資訊,請參閱屬性內容

請參閱

參考

本機 (C++)

其他資源

IDL 屬性

方法屬性

Attributes Samples