( ) . , IDL. , . , , , IDL. IDL (aliasing techniques), , , IDL.
, , IEnum. , IDL, . , IEnum IDL. Next IDL1. IDL- Next:
HRESULT Next([in] ULONG cElems, [out, size_is(cElems), length_is(*pcFetched)] double *prg, [out] ULONG *pcFetched);
, " -IDL- " Next , , , , . :
double dblElem; hr = p->Next(1, &dblElem, 0);
IDL- , [out]- ( , ). Next [call_as] (callable form) (remotable form).
[call_as] . [local] . , . [call_as] . IDL , . [call_as] Next, IDL- :
interface IEnumDoubIe : IUnknown { // this method is what the caller and object see // , [local] HRESULT Next([in] ULONG cElems, [out] double *prgElems, [out] ULONG *pcFetched); // this method is how it goes out on the wire // , [call_as(Next)] HRESULT RemoteNext([in] ULONG cElems, [out, size_is(cElems), length_is(*pcFetched)] double *prg, [out] ULONG *pcFetched); HRESULT Skip([in] ULONG cElems); HRESULT Reset(void); HRESULT Clone([out] IEnumDouble **ppe); }
C/C++ , Next, RemoteNext. , RemoteNext. , . Next RemoteNext , . , , .
[local]/[call_as] , , - . , . [local] [call_as]. B IDL , :
HRESULT STDMETHODCALLTYPE IEnumDouble_Next_Proxy(IEnumDouble *This, ULONG cElems, double *prg, ULONG *pcFetched);
[call_as] [local]. IDL :
HRESULT STDMETHODCALLTYPE IEnumDouble_Next_Stub(IEnumDouble *This, ULONG cElems, double *prg, ULONG *pcFetched);
C/C++.
. 7.10, [local]-to-[call_as] vtbl . , IDL. Next , :
HRESULT STDMETHODCALLTYPE IEnumDouble_Next_Proxy( IEnumDouble *This, ULONG cElems, double *prg, ULONG *pcFetched) { // enforce semantics on client-side // if (pcFetched == 0 && cElems != 1) return E_INVALIDARG; // provide a location for last [out] param // [out]- ULONG cFetched; if (pcFetched == 0) pcFetched = &cFetched; // call remote method with non-null pointer as last param // // return IEnumDouble_RemoteNext_Proxy(This, cElems, prg, pcFetched); }
, .
[local]-to-[call_as] . . , S_OK, :
HRESULT STDMETHODCALLTYPE IEnumDouble_Next_Stub( IEnumDouble *This, ULONG cElems, double *prg, ULONG *pcFetched) { // call method on actual object // HRESULT hr = This->Next(cElems, prg, pcFetched); // enforce semantics on object-side // if (hr == S_OK) // S_OK implies all elements sent // S_OK , *pcFetched = cElems; // [length_is] must be explicit // [length_is] return hr; }
.
[call_as] " - - ". [transmit_as] [wire_marshal]. ; . , IDL, cpp_quote. cpp_quote IDL- C/C++, IDL. cpp_quote IDL :
// surfboard.idl cpp_quote("static void Exit(void) { ExitProcess(1); }")
IDL- , C/C++ :
// surfboard.h static void Exit(void) { ExitProcess(1); }
cpp_quote IDL. REFIID. IDL
typedef IID *REFIID;
C++
typedef const IID& REFIID;
C++ IDL. IDL- :
// from wtypes.idl (approx.) // wtypes.idl ( ) cpp_quote("#if 0") typedef IID "REFIID; // this is the pure IDL definition // IDL- cpp_quote("#endif") cpp_quote("#ifdef _cplusplus") cpp_quote("#define REFIID const IID&") // C++ definition // C++ cpp_quote("#else") cpp_quote("#define REFIID const IID * const") // definition // cpp_quote("#endif")
C++ :
// from wtypes.h (approx.) // wtypes.h ( ) #if 0 typedef IID *REFIID; #endif #ifdef _cplusplus #define REFIID const IID& #else #define REFIID const IID * const #endif
, IDL.
1 , , IDL . , 1992 , IDL, . , IDL, .