I have created a simple COM component in C++ and added a method like this
interface IMathControl : IDispatch{
HRESULT AddTwoNumbers(
[in] DWORD Number1,
[in] DWORD Number2,
[out] DWORD *pResult
);
};
I have consumed above component in my C# application and it works fine.
Now, I have a struct defined in C++ as this
struct AttributeValueInfo
{
string attribute;
string value;
string description;
};
My questions are:
How I can define a method which should return the result of AttributeValueInfo type in my C++ COM component ?
How I will consume that resultant struct AttributeValueInfo in my C# application ?
I think i need to do marshaling but don't know where to start. Can someone point the steps or a simple code snippet for above scenario.
Any help will be appreciated.
interfaceis not a valid c++ keyword, so I fail to see how you used it in c++. In any case, if you need to useAttributeValueInfoas a return type in a C# application, why don't you just create a struct in your C# application calledAttributeValueInfowith the same members?