call_as

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

Enables a local function to be mapped to a remote function so that when the remote function is called, the local function is invoked.

  
      [ call_as(  
   function  
) ]  

Parameters

function
The local function that you want to be called when a remote function is invoked.

The call_as C++ attribute has the same functionality as the call_as MIDL attribute.

The following code shows how you can use call_as to map a nonremotable function (f1) to a remotable function (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 );   
};  

Attribute Context

Applies toInterface method
RepeatableNo
Required attributesNone
Invalid attributesNone

For more information about the attribute contexts, see Attribute Contexts.

IDL Attributes
Method Attributes
local
Attributes Samples

Show: