coolcake
coolcake

Reputation: 2967

Need to unmarshal interface pointers again which are received through QueryInterface?

If I receive a interface pointer present in the other apartment than the current, I am required to Marshal it at the sending apartment side and Un-marshal it at the receiving side. On interface pointer thus received can I do a QueryInterface? If I did the QueryInterface, is the pointer thus received is a usable interface pointer or does require any marshaling again?

Thanks F

Upvotes: 1

Views: 135

Answers (2)

sharptooth
sharptooth

Reputation: 170509

Yes, you can call any methods on the interface, QueryInterface() included. The proxy will behave exactly the same way as if it was a real object - it will just forward all method calls to the real object. Whenever any method you called on a proxy returns a pointer that pointer is already marshalled (or you receive an error code if it can't be marshalled) and then unmarshalled on your side which could lead to another proxy being created. So when you call QueryInterface() you receive an already unmarshalled pointer to a proxy.

Upvotes: 1

Sergey Podobry
Sergey Podobry

Reputation: 7189

You can do a QueryInterface and it will return already marshaled interface pointer (because you call QueryInterface not on a real object but on a proxy object).

Upvotes: 2

Related Questions