COM C#, How to use C++ to call COM
See the question and my original answer on StackOverflowIf you code works, its because somewhere in the C++ project, there is the following statement defined (it's automatic if you used a #import directive for example):
_COM_SMARTPTR_TYPEDEF(ICalc, __uuidof(ICalc));
_COM_SMARTPTR_TYPEDEF is a macro that defines a "smart pointer" on ICalc
. It's a Microsoft Visual C++ magical extension for easier COM support. The official documentation is here: _com_ptr_t Class
A smart pointer is usually referenced by the typedef definition provided by the _COM_SMARTPTR_TYPEDEF macro. This macro takes an interface name and the IID and declares a specialization of _com_ptr_t with the name of the interface plus a suffix of Ptr.