Search code examples
multithreadingvisual-c++comactivexmarshalling

Can different threads reuse the same marshalled ActiveX interface?


when I marshal ActiveX interface through Global Interface Table (GIT), do I need to call GetInterfaceFromGlobal() from every thread that will use this interface? Alternatively, once one thread gets a pointer to the marshaled interface, that same pointer is good to use from other threads too?


Solution

  • You have to call it from every thread. Each thread gets its own proxy.

    In theory you can use one proxy... it may work. But GetInterfaceFromGlobal may also directly return the pure interface if you call it from the creating thread... no proxy needed in this case.