Thread: Help understanding function header

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    2

    Question Help understanding function header

    I don't fully understand the following line:

    <code>
    ------------------
    int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
    {some code}

    --------------------
    </code>

    What does the "void **ppobj" argument mean?

    Thanks.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    It's a double pointer (pointer to a pointer) of an undefined type (could be anything).
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User pinko_liberal's Avatar
    Join Date
    Oct 2001
    Posts
    284
    Originally posted by Magos
    It's a double pointer (pointer to a pointer) of an undefined type (could be anything).
    I don't know what you mean by undefined type. It is clearly a pointer to the type void *. void is a type, it is an incomplete type which cannot be completed, which implies that one cannot apply sizeof to it, the type void still has a utility, one casts the value returned by a function as void when we want to discard the value returned by it. For eg., a typical use might be
    Code:
    (void) printf("Hello World");
    ppobj is a pointer to void *. void * is a an object type. Pointer to any object type can be converted to void * and back again without any loss of information which makes it valuable as a generic pointer.
    The one who says it cannot be done should never interrupt the one who is doing it.

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    2
    Thanks to both of you. What you wrote lead me to a section in a book about multiple indirection and void * pointers.

    It's c++ book but "a void pointer can be assigned to any type of pointer without the use of a type cast."

    and
    "The most common use of void * is as a function return type."

    Again. thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Replies: 30
    Last Post: 06-19-2006, 12:35 AM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  5. Header file for "fix" function ?
    By Rex in forum C++ Programming
    Replies: 1
    Last Post: 04-08-2003, 04:42 AM