How can I marshal a COM link outside a process across process boundaries?

I have a COM server outside the process that needs to keep track of things. This server works as a service and is internal, single point. For simplicity, I will call it BossCom.

I have another COM server outside the process, which is working. This means that a one-time server is used for system stability (this means that when creating 2 WorkerCom, 2 WorkerCom.exe works). For simplicity, I will call it WorkerCom.

WorkerCom can run anything, even on its own, if someone starts it through the command line with the correct command line arguments.

The overall goal is to let BossCom know what WorkerComs are, know what they are doing, and can give them orders (pause, stop, ramp up, etc.).

My initial thought in this would be that whenever WorkerCom starts, it will be CoCreateInstance BossCom and called BossCom-> RegisterWorker (IUnknown me). Then, when WorkerCom is about to shut down, he will call BossCom-> UnregisterWorker (IUnknown me). BossCom can QueryInterface IUnknown for IWorkerCom and be able to issue commands.

This will work fine if all of these COM objects are in the same process, but this is not the case. I thought about using GlobalInterfaceTable, but it is only global in the sense of a single process.

I spent several days exploring this, and I am at a loss. Perhaps I am nicknamed in the tunnel.

com Boss?

, , , BossCom #, WorkerCom ATL ++, , VB, Scala, Lisp - . , .: -)

+5
5

, . , .

, #, , IntPtr. , IntPtr , , , .

MarshalAs . RegisterWorker :

    public void RegisterWorker(
        [In, MarshalAs(UnmanagedType.IUnknown)] object ptr
        )
    {
        IWorkerCom worker = (IWorkerCom) ptr;
        Workers.Add(worker);
    }

.

+2

Monikers, COM- .

+2

- , . BossCom , . MSDN , . ...

+1

#. . ATL, IDL. RegisterWorker(). , . .

+1

All Articles