I am converting C ++ to C ++ / CLI and would like to expose some managed classes as COM objects. In C #, this was easy, and setting [ComVisible] and inheriting from the interface (also ComVisible) did the job. However, a C ++ project created as C ++ / CLI does not export DllRegisterServer.
Here is a sample project (launched from the CLR Console Application project in VS 2008).
#include "stdafx.h" using namespace System; using namespace System::Runtime::InteropServices; [ComVisible(true)] [Guid("E3CF8A18-E4A0-4bc3-894E-E9C8648DC1F0")] [InterfaceType(ComInterfaceType::InterfaceIsDual)] public interface class ITestInterface { void TestMethod(); }; [ComVisible(true)] [Guid("1514adf6-7cb0-4561-9fbb-b75c0467149b")] public ref class CliComClass : ITestInterface { public: virtual void TestMethod() { } }; int main(array<System::String ^> ^args) { Console::WriteLine(L"Hello World"); return 0; }
When I run regsvr32 on the .exe output, I got an error when the DllRegisterServer was not found. I tried Google for some help, but without success.
c # com c ++ - cli
Petr havlicek
source share