从C ++应用程序调用托管DLL [英] Calling managed DLL from C++ app

查看:122
本文介绍了从C ++应用程序调用托管DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试基于MS从非托管中访问C#DLL
链接
。创建界面指针时,

I am trying to access a C# DLL from unmanaged based on the MS link. When creating the interface pointer ,

ICalculatorPtr pICalc(__uuidof(ManagedClass));


我收到错误"Class not registered"。  ; $


我已经构建了DLL。 tlb和tlh都已创建,RegASM也是成功的。 tlb已成功导入。



当我尝试使用regsvr32命令注册DLL时,它表示DLL无效。这可能有什么问题?

I am getting the error "Class not registered". 

I have built the DLL. The tlb and tlh all have been created and RegASM is success too. The tlb has been successfully imported.

When I try to register the DLL using regsvr32 command, it says like the DLL is not valid. What could be wrong here?



推荐答案


我试图从非托管中访问C#DLL基于MS
链接
。创建界面指针时,

ICalculatorPtr pICalc(__uuidof(ManagedClass));


我收到错误"Class not not已注册"。 
$


我已经构建了DLL。 tlb和tlh都已创建,RegASM也是成功的。 tlb已成功导入。



当我尝试使用regsvr32命令注册DLL时,它表示DLL无效。这可能有什么问题?

I am getting the error "Class not registered". 

I have built the DLL. The tlb and tlh all have been created and RegASM is success too. The tlb has been successfully imported.

When I try to register the DLL using regsvr32 command, it says like the DLL is not valid. What could be wrong here?




管理的COM对象由RegAsm注册。 在这种情况下无需运行regsvr32.exe。

The managed COM object is registered by RegAsm.  There is no need to run regsvr32.exe in this situation.

运行RegAsm时是否在命令行参数中指定了/ codebase?

When you ran RegAsm did you specify /codebase in the command line parameters?

您是否从提升的命令提示符运行RegAsm? 运行时发出的任何错误消息?

Did you run RegAsm from an elevated command prompt?  Any error messages issued when you ran it?


这篇关于从C ++应用程序调用托管DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆