启用COM接口的封送处理需要什么? [英] What is required to enable marshaling for a COM interface?

查看:253
本文介绍了启用COM接口的封送处理需要什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个32位ATL COM组件,没有类型库。

I have a 32-bit ATL COM component without a type library. It has a class factory for one given class that implements several interfaces.

当我使用它作为一个in-proc服务器时,一切都很好 - 客户端调用CoCreateInstance() ),对象被实例化,QueryInterface()检索指向所请求接口的指针。但是当我把组件放入COM +我不再能实例化类 - CoCreateInstance()现在返回E_NOINTERFACE。

When I use it as an in-proc server, everything works fine - the client side invokes CoCreateInstance(), the object is instantiated and QueryInterface() retrieves a pointer to a requested interface. But when I put the component into COM+ I no longer can instantiate the class - CoCreateInstance() now returns E_NOINTERFACE.

我相信问题是COM +不能执行封送因为没有类型库 - 它不知道如何做。我需要生成并注册一个类型库来解决这个问题,还是有其他方法?

I believe the problem is that COM+ can't perform marshaling because of absence of type library - it has no idea how to do it. Do I need to generate and register a type library to resolve this or is there any other way?

推荐答案

Urk。我建议您询问 microsoft.public.vc.atl 因为我认为你会在那里找到更多的专家。我认为(虽然我不是一个专家)的问题没有COM +比注册代理/存根的问题。 (换句话说,即使你编写自己的COM客户端来访问你的组件进程外,你可能会遇到同样的问题)如果你有标准的自动化兼容的接口,那么Windows知道如何封送你的对象精细。

Urk. I would recommend asking on microsoft.public.vc.atl as I think you will find more experts there. I think (though I'm not an expert) the issue has less to do with COM+ than the issue of registered proxy/stubs. (In other words, even if you wrote your own COM client to access your component out-of-process, you would probably run into the same issue) If you have standard Automation-compatible interfaces, then Windows knows how to marshal your objects just fine. But otherwise it is confused.

没有类型库,你需要注册代理/存根,或者需要实现IMarshal自己来处理自定义封送。 (或者也有这个处理程序封送的事情,我不明白)

Without a type library, you either need to register proxy/stubs, or need to implement IMarshal yourself to handle custom marshaling. (or there's also this "handler marshaling" thing that I don't understand)

您的意见,为什么你没有类型库(实现一个接口已经定义由微软,但没有typelib一个)提出了一个红旗与我。你能提供更多的细节吗?如果它是在.DLL或.EXE中的东西,但类型信息是在库本身(而不是一个外部.TLB文件),它可能提取正确的信息,使一切工作,我只是不熟悉处理。

Your comment about why you don't have a type library (implementing an interface already defined by Microsoft, but one which doesn't have a typelib) raises a red flag with me. Can you provide more details? If it's something in a .DLL or .EXE, but the type information is inside the library itself (rather than an external .TLB file) it's probably possible to extract the right information to make everything work, I'm just not familiar with the process.

(对于记录,我已经离开ATL / COM编程偏爱Java,所以虽然我可以让你知道我在过去记得,现在使用工具,我很难回到他们提供任何更多的帮助,但microsoft.public.vc.atl上的人是很聪明。)

(For the record, I've left ATL/COM programming in favor of Java, so although I can let you know what I remember in the past, I don't use the tools now and it would be difficult for me to get back into them to provide any more help. But the folks on the microsoft.public.vc.atl are pretty smart.)

这篇关于启用COM接口的封送处理需要什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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