What's the point of _MERGE_PROXYSTUB?
来源:互联网 发布:手机如何修改网络密码 编辑:程序博客网 时间:2024/06/16 03:34
I have generated an ATL COM object using VS2008 and the code contains references to a definition called _MERGE_PROXYSTUB
(because I chose the 'Merge proxy/stub' option when I initially ran the wizard.)
What is the point of a proxy/stub? If I don't select the the merge option then I get a separate MyControlPS.DLL
instead - when would this ever be used?
FWIW the control seems to register and work fine if I remove all the code surrounded by the _MERGE_PROXYSTUB
defines. A debug build doesn't even define _MERGE_PROXYSTUB
and it still works OK.
So, can I do without a proxy/stub?
结论
You need a proxy/stub if you want your COM object to be called from an application using a different threading model than your COM object.
For example, we have a plug in that gets loaded by an application that uses a particular threading model (can't remember which), but our COM object is multithreaded apartment (MTA) - so the the proxy/stub is required to marshall the data between the objects when a function call is made, while still adhering to the rules of the threading model.
If these rules are broken, then COM will either throw an exception or return a failure HRESULT such as *RPC_E_WRONG_THREAD*
If you don't check the merge proxy/stub option, then visual studio produces a seperate project for the proxy/stubs which get build into a seperate dll. This makes things more difficult for deployment if they are required, but you can basically just ignore them if you are not affected by threading model issues.
So you can do without proxy/stubs if the application calling the COM object is using the same threading model as your object
Larry Osterman provides a readable introduction to threading models on his blog.
- What's the point of _MERGE_PROXYSTUB?
- What’s the point of usability testing?
- What's the point of DeferWindowPos?
- What's the point of DeferWindowPos?
- What's the point of Spring MVC's DelegatingFilterProxy?
- Base Point@What's the heap and stack?
- what's the meaning of these numbers?
- what's the meaning of Shell?
- What's the meaning of EOF ?
- what's the meaning of BPM?
- what's the function of pid file?
- what's the meaning of IFS
- What's a ‘sequence point’
- What's the meaning of the saturation arithmetic
- 语录 - What's the future of the software industry?
- 语录 - What's the future of the software industry?
- 语录 - What's the future of the software industry?
- What's the methodLists attribute of the structure objc_class for?
- 关于 @import
- hover改变其他元素样式
- Anjular+Bootstrap前端开发案例实战
- HBase java 统计表行数
- SQL Server 2008登录错误:无法连接到(local)
- What's the point of _MERGE_PROXYSTUB?
- 周赛
- Android Studio 快捷键整理
- 解析xml文件
- Jetty配置
- Spring利用Quartz实现定时调度
- 浏览器唤醒检测本机app
- CocoaPods install/update 遇到的问题
- UVA - 11732 依旧是字典树板子,和左儿子右兄弟法字典树