locked
the meaning of ** in idl RRS feed

  • Question

  • Hey, using MS oleviewer.exe, I was able to find a method I need, being:

     

    HRESULT GetID(

    [out] IMapCollection** ppMapCollection,

    [out] ICertifCheck** ppCertifCheck,

    [out, retval] IRetStatus** ppRetStatus);

     

    However, I cant figure out what the ** means... Sad

    Any suggestions would be much appreciated!

    Wednesday, April 30, 2008 2:42 PM

Answers

  • IMapCollection** points to a two dimensional array of IMapCollection objects.

     

    Excuse me, Is this a joke?

    IMapCollection** as nothing to do with 2dimensional arrays whatsoever.

    And IMapCollection*** isn't a 3D array either...

     

    the meaning of those ** is simply that the method call gives you an IMapPointer*.

    In order to be able to give this to you, it has to be stored somewhere. YOU have to provide the storage, which is typically done like this:

     

    IMapCollection* collection = NULL;

    foo(&collection)  //notice the &? we are providing the address of the pointer value. i.e. this is a pointer to a pointer: **

    collection->DoStuff();  //use the collection*, which now contains a valid pointer value.

    Wednesday, April 30, 2008 5:41 PM
  • It looks like it might be Clarion http://www.softvelocity.com/

     

    Friday, May 2, 2008 4:01 PM

All replies

  • I won't be online for another 4 days, so sorry in advance if you took the time to reply and I'm not answering you back...

    In case anyone wonders, this is my code to adress it...

    Its no .NET unfortunately... Sad

     

     

    Code Snippet

    BCIEId.InitOle                 PROCEDURE()
      CODE
     
      IF ~SELF.Ole
        SELF.Ole = CREATE(0,CREATE:OLE)
        SELF.Ole{Prop:Create} = 'EIDLIBCTRL.EIDlib'
        SELF.Ole{PROP:ReportException} = 1
        SELF.Ole2 = CREATE(0,CREATE:OLE)
        SELF.Ole2{Prop:Create} = 'EIDLIBCTRL.MapCollection'
        SELF.Ole2{PROP:ReportException} = 1
        SELF.Ole3 = CREATE(0,CREATE:OLE)
        SELF.Ole3{Prop:Create} = 'EIDLIBCTRL.CertifCheck'
        SELF.Ole3{PROP:ReportException} = 1
       
      .
      SELF.IRetStatus =  SELF.OLE{'Init("",1,1,' & SELF{Prop:Handle} & ')'}

      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


      SELF.IRetStatus = SELF.OLE{'GetID(' & ADDRESS(SELF.Ole2) & ', ' |    !Returns error!
                                          & ADDRESS(self.ole3) & ')'}

     


      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


      RETURN

     

     


    Wednesday, April 30, 2008 3:19 PM
  • IMapCollection* is a pointer to an IMapCollection

    IMapCollection** is a pointer to an IMapCollection*

     

    IMapCollection* points to a single dimensional array of IMapCollection objects.

    IMapCollection** points to a two dimensional array of IMapCollection objects.

    Wednesday, April 30, 2008 4:23 PM
  • IMapCollection** points to a two dimensional array of IMapCollection objects.

     

    Excuse me, Is this a joke?

    IMapCollection** as nothing to do with 2dimensional arrays whatsoever.

    And IMapCollection*** isn't a 3D array either...

     

    the meaning of those ** is simply that the method call gives you an IMapPointer*.

    In order to be able to give this to you, it has to be stored somewhere. YOU have to provide the storage, which is typically done like this:

     

    IMapCollection* collection = NULL;

    foo(&collection)  //notice the &? we are providing the address of the pointer value. i.e. this is a pointer to a pointer: **

    collection->DoStuff();  //use the collection*, which now contains a valid pointer value.

    Wednesday, April 30, 2008 5:41 PM
  • An IMapCollection** requires two levels of indirection to access the IMapCollection object.  That is no different than an array.  In fact a pointer can be seen as a way to access the first element of an array. i.e., in your example

     

    Code Snippet
    collection[0].DoStuff()

     

     

    would accomplish the same result.  '->' is just a convenience for accessing the first item.  Now, inside of Foo, where your pointer is being set, it has to do something along the lines of


    Code Snippet
    *passed_collection = new IMapCollection(what not and the other thing); 

     

     

    Now if you wanted to get a reference to the item that was just created inside of foo(), you would have to do

     

    Code Snippet

    IMapCollection& ref_obj(passed_collection[0][0]);

     

    It just happens that the two dimensions in this scenario are both zero.

     

     

    Now, however, I will acknowledge that your answer is more of what the OP was looking for.

    Wednesday, April 30, 2008 10:25 PM
  •  jannemanrobinson wrote:


    Its no .NET unfortunately...



    Not sure I can wait for 4 days.  Anybody know what this language is?  Something Belgian?
    Thursday, May 1, 2008 1:43 AM
  •  nobugz wrote:
     jannemanrobinson wrote:


    Its no .NET unfortunately...



    Not sure I can wait for 4 days.  Anybody know what this language is?  Something Belgian?

     

    English?

    I think the original poster expresses regret at the fact that he cannot use .NET to solve his problem.

    Thursday, May 1, 2008 8:08 AM
  • His code snippet.  Hehe.
    Thursday, May 1, 2008 8:58 AM
  • It looks like it might be Clarion http://www.softvelocity.com/

     

    Friday, May 2, 2008 4:01 PM
  • Hey jensen, nobugz, bruno.

    Thank you for taking the time to reply to my post.

    First of all, yes I was expressing my unhappyness about the fact that I can't write in visual studio where I work.  My favorite language is C#, I'm trying to learn C++ though because it kind of gives you more power to really finetune your code. 

    Speaking of wich, the language forced upon me is indeed CLARION.  Clarion is a template-driven development environment, basically you click some options, that generates some CLARION code, wich in turn is translated by the environment to C++ blackbox dll's upon build.  Basically, you click some options, it generates a complete program and if there's any small detail about the program you don't like and want to change, be prepared for days of hell...

    The specific problem here was that I had to integrate a belgian identity card reader in our software.  Our gouvernment lets you download some kind of a runtime environment.  After installing it, a new COM object appeared on my computer.  Opened visual studio first >> add reference >> VS generates the necessary classes >> 2 minutes later I had my identity card's info (name, picture, ...) on my screen.  However, since we can't use VS, opened CLARION, created an ole object (black box link to a COM object) and been swearing for the last week.

    With this newfound understanding of the  COM object, I hope I'll have better luck writing my wrapper in CLARION.

    Wish me luck and once again, thank you for replying!

    Monday, May 5, 2008 11:51 AM