How to pass out an array from a com+ object?
-
I am developing an application which need to pass an array from a com+ object to the client,the object runs at the server and the client app runs at a workstation.the problem is i can't get the actual array at the client's side. some represetative code follows: //.idl [id(15), helpstring("method GetAllPolicyID")] HRESULT GetAllPolicyID([in,out]long* size,[out,size_is(,*size)] long** PolicyID); //.cpp *size=pRst->RecordCount; *PolicyID=(ULONG*)CoTaskMemAlloc(*size*sizeof(ULONG)); for(long i=0;i<*size;i++) { if(!pRst->adoEOF) { vt=pRst->GetCollect("POLICYID"); (*PolicyID)[i]=vt.lVal; pRst->MoveNext(); } } Scratch
-
I am developing an application which need to pass an array from a com+ object to the client,the object runs at the server and the client app runs at a workstation.the problem is i can't get the actual array at the client's side. some represetative code follows: //.idl [id(15), helpstring("method GetAllPolicyID")] HRESULT GetAllPolicyID([in,out]long* size,[out,size_is(,*size)] long** PolicyID); //.cpp *size=pRst->RecordCount; *PolicyID=(ULONG*)CoTaskMemAlloc(*size*sizeof(ULONG)); for(long i=0;i<*size;i++) { if(!pRst->adoEOF) { vt=pRst->GetCollect("POLICYID"); (*PolicyID)[i]=vt.lVal; pRst->MoveNext(); } } Scratch
You must produce a proxy-stub DLL by compiling and linking the C files produced by MIDL. The ATL AppWizard produces a make file called projectps.mk to do this. You must make sure that your server does not register its component's interfaces as type library marshaled with the automation marshaler because automation does not recognize the array attributes. (marshaling done by custom marshaler in your proxy/stub DLL) soptest
-
You must produce a proxy-stub DLL by compiling and linking the C files produced by MIDL. The ATL AppWizard produces a make file called projectps.mk to do this. You must make sure that your server does not register its component's interfaces as type library marshaled with the automation marshaler because automation does not recognize the array attributes. (marshaling done by custom marshaler in your proxy/stub DLL) soptest