跨不同组件的接口名称重复 [英] Duplicate Interface Names Across different components

查看:129
本文介绍了跨不同组件的接口名称重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Visual Studio解决方案有大约10个项目.每个项目都有不同的目标,并且某些项目使用其他项目的输出.大多数项目是由DLL表示的ActiveX组件.每个项目都有自己的一组接口.我想在ProjectB中定义新接口,但要保持与ProjectA中使用的接口名称相同(但CLSID不同).项目A使用ProjectB的输出.构建解决方案时,出现指示重新定义的编译错误.这个问题怎么解决?是否实用?我认为这很实用,因为应用程序可以使用来自不同供应商的组件,并且每个供应商都可以开发组件,而不必担心保留唯一名称但要确保唯一ID.但是,如何解决编译问题呢?

My Visual Studio solution has around 10 projects. Each project has different target and some projects use output of other projects. Most of the projects are ActiveX components represented by DLLs. Each project has its own set of interfaces. I want to define new interfaces in ProjectB but want to keep the interface name same ( but different CLSID) as the one used in ProjectA. The project A uses output of ProjectB. When I build the solution, I get compilation errors indicating re-definition. How this isssue can be resolved? Is it practical or not? I think it is quite practical because an application may use components from diffrent vendors and each vendor develops component without bothering about keeping the unique names but ensuring unique id. But how to resolve compilation issues ?

推荐答案

如果接口是在单独的命名空间中定义的,那就没关系了.您必须确保,当一个类同时使用两个接口时,它们必须完全合格.

希望我表达清楚.

修改:在为解决命名冲突而专门设计了所有名称空间之后.修改结束

干杯,

曼弗雷德(Manfred)
If the interfaces are defined in speparate namespaces it shouldn''t matter. You have to make sure though that when one class uses both interfaces they would have to be fully qualified.

I hope I expressed it clearly.

Modification: After all namespaces were especially made for resolving naming conflicts.End of modification

Cheers,

Manfred


这篇关于跨不同组件的接口名称重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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