HOW to pass ARRAY OF STRUCTURES in COM DYNAMICALLY thru interface methods
Can any body tell me how do i pass ARRAY OF STRUCTURES IN COM DYNAMICALLY FROM A outproc server to client.
eg..
I have a structure A { int x, float y, char z} of size [n] .. i would like to fire this data through my outgoing interface . Is there any way please
reply me.
srini s ([email protected])
Re: HOW to pass ARRAY OF STRUCTURES in COM DYNAMICALLY thru interface methods
Look at COleSafeAray. You can create a 1 dimensional byte array COleSafeArray::CreateOneDim
copy your structure byte-per-byte into the array, then get the VARIANT out of the array using ColeSafeArray::Detach()
. You now have your structure in a VARIANT, which can be marshalled by both COM & DCOM. Also you have to free the memory allocated manually (since you called Detach()); call VariantClear() to do the job.
MJA