Eynix
Eynix
CC#
Created by Eynix on 6/1/2023 in #help
❔ COM type library integration in C++ project
Hi everyone. I've made a dummy .net COM type library and I'm trying to integrate it in an equaly dummy C++ project. The project compile and link, but I have an _com_errorexception at runtime : Error in DLL. Here's the library code:
using System.Runtime.InteropServices;

namespace SomeClass
{
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface ComClass1Interface
{
}

[Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ComClass1Events
{
}

[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ComClass1Events))]
public class ComClass1 : ComClass1Interface
{
public static int Doubled(int i)
{
return i * 2;
}
}
}
using System.Runtime.InteropServices;

namespace SomeClass
{
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface ComClass1Interface
{
}

[Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ComClass1Events
{
}

[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ComClass1Events))]
public class ComClass1 : ComClass1Interface
{
public static int Doubled(int i)
{
return i * 2;
}
}
}
42 replies