Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Contradiction in MSDN Documentation?

Back to Forum: Tech Off
  • User profile image
    W3bbo

    I'm reading up on COM (in Local MSDN2008) and found this.

     

    In this article ( ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/com/html/6db17ed8-06e4-4bae-bc26-113176cc7e0e.htm ) ""Rules for Implementing QueryInterface" it says:

     

    "For any given object instance, a call to QueryInterface(IID_IUnknown, ...) must always return the same physical pointer value. This allows you to call QueryInterface(IID_IUnknown, ...) on any two interfaces and compare the results to determine whether they point to the same instance of an object."

     

    But in another article in the same chapter "Implementing Reference Counting" ( ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/com/html/d4fd98c9-afa4-4c5c-a3c9-44d34881cbdb.htm ) it says:

     

    "COM does not require that an object return the same pointer when asked for the same interface multiple times. (The only exception to this is a query to IUnknown, which identifies an object to COM.) This allows the object implementation to manage resources efficiently."

     

    Am I misunderstanding anything here?

  • User profile image
    ManipUni

    Those say the same thing. IUnknown returns a static object which allows you to query other interfaces available. Those interfaces can have different addresses including within individual instances.

  • User profile image
    W3bbo

    ManipUni said:

    Those say the same thing. IUnknown returns a static object which allows you to query other interfaces available. Those interfaces can have different addresses including within individual instances.

    Ah.

     

    I misread the first quotation. I thought it was saying that QueryInterface must return the same pointer for any other call to QueryInterface with the same arguments, I overlooked the "IID_IUnknown" bit). My bad.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.