Pet*_*cek 7 c# com c++-cli comvisible
我正在将C++转换为C++/CLI,并希望将一些托管类公开为COM对象.在C#中它很容易并且设置[ComVisible]并继承自界面(也是ComVisible)完成了这项工作.但是,作为C++/CLI的C++项目构建不会导出DllRegisterServer.
这是示例项目(从VS 2008中的CLR控制台应用程序项目开始).
#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;
}
Run Code Online (Sandbox Code Playgroud)
当我在输出.exe上运行regsvr32时,我收到错误,说没有找到DllRegisterServer.我试过谷歌一些帮助,但没有成功.
归档时间: |
|
查看次数: |
4116 次 |
最近记录: |