宣告非同步管道
下列範例 IDL 檔案會定義一般管道結構,以及具有管道的非同步 RPC 函式。
範例
//file: Xasyncpipe.idl:
//
interface IMyAsyncPipe
{
//define the pipe type
typedef pipe int aysnc_intpipe ;
//then use it as a parameter
int MyAsyncPipe(
handle_t hBinding,
[in] a,
[in] ASYNC_INTPIPE *inpipe,
[out] ASYNC_INTPIPE *outpipe,
[out] int *b) ;
};
//other function declarations
//other interface definitions
//end Xasyncpipe.idl
//file:Xasyncpipe.acf:
//file: Xasyncpipe.acf:
interface IMyAsyncPipe
{
[async] MyAsyncPipe () ;
} ;
//
//end Xasyncpipe.acf
下列程式碼片段顯示典型的管道結構定義。 其中包含推入和提取程式的指標、用來保存管道資料的緩衝區,以及用來協調程式的狀態變數:
//
typedef struct ASYNC_MYPIPE
{
RPC_STATUS (__RPC_FAR * pull) (
char __RPC_FAR * state,
small __RPC_FAR * buf,
unsigned long esize,
unsigned long __RPC_FAR * ecount );
RPC_STATUS (__RPC_FAR * push) (
char __RPC_FAR * state,
small __RPC_FAR * buf,
unsigned long ecount );
void *Reserved;
char __RPC_FAR * state;
}ASYNC_INTPIPE;