Visual Studio .NET 2003

When exposing the functionality of a COM objects with complex interfaces to managed components, you often need to implement custom runtime callable wrapper classes for the objects. Managed Extensions for C++ provides a low-overhead, straightforward implementation for using runtime callable wrappers. This provides the following benefits:

  • You can implement a wrapper class by mixing managed and unmanaged code to interoperate with any COM component.
  • You can implement a wrapper class does not require an interop assembly or a type library.
  • You can choose whether to expose all types or only a subset of the types defined in a type library.
  • Your wrapper classes do not have to use runtime callable wrappers to access COM components, and they do not have to use PInvoke to use platform services in the implementation of the wrapper class.

You can use Tlbimp.exe (Type Library Importer), but it has several limitations:

  • It emits metadata in the generated interop assembly for all types defined in the type library and does not allow you to expose a subset.
  • If a type library is not available for the COM server, then you cannot use TlbImp.exe.
  • It cannot generate interop assemblies for all type libraries.

Go to the next step

See Also

Managed Extensions for C++ and COM Interoperability Tutorial

© 2016 Microsoft