Making a custom surrogate for a dll com server

旧街凉风 提交于 2019-12-11 08:05:42

问题


the only 2 guides i've found for making a custom surrogate were not very clear (http://masterblood.ru/ch12c.shtml) (http://msdn.microsoft.com/en-us/library/ms682432(v=vs.85).aspx)

does anyone know of any full working examples of one? I think it would be helpful for me to see.

If not, I'm confused about how exactly I implement the interfaces they say I need to implement (IMarshal, IUnknown, and IClassFactory) I know I need to write functions like loaddllserver and freesurrogate myself, but do i actually have to write functions like addref and release myself too? Usually when i create a com object, I use ATL and use all of those Macros to define those functions, but that doesnt work unless you create the com object with cocreateinstance, and they seem to be using new. also, the msdn page for IMarshal says "Implement IMarshal only when you believe that you can realize significant optimizations to the COM default implementation. " I don't have any optimizations to make to the marshalling so I'd like to use theirs if possible. I know the non-msdn page doesnt mention IMarshal, but MSDN says I need to use it.

Are the surrogate objects normal com objects, or are they just regular objects that inherit from those Interfaces? do I need an idl file?

I understood what the example on the site did, but I'm confused about how the classes get defined in the first place.

Any help you could give would be great.

Thanks.

来源:https://stackoverflow.com/questions/5505703/making-a-custom-surrogate-for-a-dll-com-server

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