What is the preferred method of marshalling COM interfaces across threads?

不羁的心 提交于 2020-01-13 01:39:11

问题


What are the pros/cons of using the GIT as opposed to CoMarshalInterThreadInterfaceInStream and CoGetInterfaceAndReleaseStream for marshalling COM interfaces across threads?

Are there strong reasons for preferring one method over the other, or is it more a matter of personal preference?


回答1:


From MSDN:

If you are unmarshaling an interface pointer multiple times between apartments in a process, you might use the IGlobalInterfaceTable interface. With other techniques, you would have to remarshal each time.

Besides that, I would say it's mostly a matter of preference.




回答2:


You need a copy of Essential COM by Bon Box, when I used to work with COM, I would reach for Don's book whenever I had this sort of question.



来源:https://stackoverflow.com/questions/1612759/what-is-the-preferred-method-of-marshalling-com-interfaces-across-threads

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!