I have created a COM server in which a collection of vectors need to
be exposed to C# sharp client .
Each vector contains a array of structures and this vector need to be
embedded inside a container, say another vector or list.
Code:
typedef struct
{
std::string name;
std::string type;
} STAGE_INFO;
std::vector<STAGE_INFO m_stages;
m_stages.push_back(current_stage)
Since STL classes are not accessible in C#, I used a SAFEARRAY and
VARIANT for exposing them. But I am not successful because of the
following reason .
1) I am not able to create a VARIANT array of structures.
2) I created a SAFEARRAY of structures and included it in a VARIANT,
but when accessed in C# as Object, I am not able to get the structure.
Though I am able to typecast it into a Object array , but if accessed
in separte gives exception.
3) I am able to access the members of the structure as they are string
but not a STRUCTURE as a whole.
4) I tried containing a VARIANT of SAFEARRAY'S in another VARIANT, but
it gives a casting error.
5) CComVariant cannot have USD's and VARIANT if used has some problem
of Memory Leaks.
Please let me know if you have expertise in COM and C#.Net
Interoperability.
or
Even if you have some alternate solution for this problem?
Thanks In Advance .. expecting your earliest reply.
_________________
Life Rocks,
$dhanu's$