Passing complex type through COM interface ?
-
Hi all, Can anybody give me some pointers on how to pass the following complex type through a COM interface ?
typedef struct ComplexType
{
Type type; // can be INT, BSTR, BYTE* etc.
union
{
int intVal;
BSTR strVal;
BYTE* pbyteVal;
AnotherComplexType* pcomplexVal;
};
};The real type contains different fields but you should get the idea: it basically is just like a VARIANT only with more levels of indirection. I need to pass these structures between my COM component and non-COM legacy code. Unfortunately, there is a threading issue that causes a proxy and stub to be created even for in-process deployment of my component, so simply passing a pointer doesn't work. Should I resort to custom marshalling ? Kind regards, Alwin!
-
Hi all, Can anybody give me some pointers on how to pass the following complex type through a COM interface ?
typedef struct ComplexType
{
Type type; // can be INT, BSTR, BYTE* etc.
union
{
int intVal;
BSTR strVal;
BYTE* pbyteVal;
AnotherComplexType* pcomplexVal;
};
};The real type contains different fields but you should get the idea: it basically is just like a VARIANT only with more levels of indirection. I need to pass these structures between my COM component and non-COM legacy code. Unfortunately, there is a threading issue that causes a proxy and stub to be created even for in-process deployment of my component, so simply passing a pointer doesn't work. Should I resort to custom marshalling ? Kind regards, Alwin!
Define your type(s) in IDL and it will create marshalling code for it. -- He just smiled and gave me a vegemite sandwich.