I have a COM object in my DLL which I would like to expose out-of-proc. I know that out-of-proc COM object can only be开发者_开发技巧 used from within an executable. What I'm wondering if it's possible to use something like dllhost.exe or runddl32.exe to host my DLL and expose my object as out-of-proc? I read something about surrogates, could anyone off some info on how I could do this?
My end goal is to have an out-of-proc COM object, hosted in a DLL (which is hosted in an executable using LoadLibrary, etc). This COM object would utilize the Singleton Class Factory available in ATL. It will be a class that shares data to all processes that connect to it.
Thanks.
Option 1 - use surrogate activation.
Option 2 - use COM+ Control Panel->Administrative Tools->Component Services - create a "server" COM+ application and just add your classes there.
Anyway you'll need marshalling stuff for the interfaces implemented by your object - either a proxy/stub pair or (if all interafces are Automation-compatible) a typelib.
精彩评论