Charlie
Charlie

Reputation: 794

What happens if I use a marshalled COM interface pointer in the object creating thread?

I am looking into the usage of Global Interface Table. I understand that when you call GetInterfaceFromGlobal() from another STA thread you get a proxy to the original interface pointer. The proxy is responsible for passing control to the object creating thread.

What if I have only one thread and call GetInterfaceFromGlobal() in this only thread, i.e. the object creating thread, and then use the returned interface pointer (actually a proxy) just like using the original interface pointer? In other words, is the proxy (which is supposed to be used by another thread) usable to the main thread?

And what if I use the Global Interface Table in MTA threads for MTA object? Will it work or corrupt?

Thanks in advance.

Upvotes: 3

Views: 337

Answers (1)

Hans Passant
Hans Passant

Reputation: 941625

You will get your own pointer back since no proxy is necessary.

Upvotes: 2

Related Questions