//coclass
[Guid("6FAE8EEA-F005-45a2-8DC6-BAB6B9645DE1"), ClassInterface(ClassInterfaceType.None)]
public class Class1 : Test
{
public Class1()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public int MyAdd(int a, int b)
{
return a + b;
}
}
}
C++代码如下:
#import "..\ClassLibrary1\bin\Debug\ClassLibrary1.tlb" no_namespace named_guids
extern "C" _declspec(dllexport) int add(int a,int b)
{
CoInitialize(NULL);