I might be missing something here, but I can't figure out how this approach would work when my structure contains some pointers like BSTR. Could some one explain me a little bit if this approach can work with structure containing pointers?
I used this ComArray template class for passing array of structures from COM client's to Inproc servers. But i failed to pass a structure containing a BSTR elements to a remote server. Is any marshalling support required??.
I suspect that the SetAt() fn copies only the top level pointers i.e, the BSTR [since BSTR being a ptr to a ptr] and not the data.
When I'm right the clue of this approach lies in making the information typless (VARIANT) and hope that
copying it in memory bit by bit later receives the correct structure.
But this assumes that the compiler always generates the same code for the class T on both sides of the COM
barrier. When marshalling across system boundaries, for exsample from WinNT to Win3x this would crash in the
same way than flattening the memory to a BSTR.
But maybe there is no generic and system independent way to marshall arbitrary data. I my opinion this is
the case. Please tell me that I'm wrong.