views:

26

answers:

1

I just wonder if that is possible.

I know simple types can be read through com interface. Does anyone have experience with complex types as structs and classes?

+2  A: 

Simple types are passed through COM as Variants. Strings, ints, floats, IUnknown interfaces, and arrays of all of these can be carried in Variants.

C# and other .NET managed language types can be exposed through COM to unmanaged code, but COM will limit your options to basically interfaces. You should define interfaces in your managed code and tag them with the ComVisible attribute so that they can be seen by COM. Implement those interfaces on your classes or structures and you're good to go.

I forget offhand how to instantiate a managed class from unmanaged code via COM, but search for .NET COM interop and it should be in there somewhere.

dthorpe