COM typedefs

Discussion in 'C++' started by Claus77, Oct 24, 2006.

  1. Claus77

    Claus77 Guest

    hi there,

    i'm just programing a com-interface and within my .idl file i define
    a struct, somehow like this:

    typedef struc struk
    {
    int a;
    long b;
    }struk;

    which is uses in a method:

    test(struk a)
    {
    ....
    }


    now my problem:
    how can i call this function from vb-script without getting an error?
    do i have to define the struct in another way as here shown?
    in c++ its easy, because i can call the struct directly...

    greetings,
    claus
    Claus77, Oct 24, 2006
    #1
    1. Advertising

  2. Claus77

    Salt_Peter Guest

    Claus77 wrote:
    > hi there,
    >
    > i'm just programing a com-interface and within my .idl file i define
    > a struct, somehow like this:
    >
    > typedef struc struk
    > {
    > int a;
    > long b;
    > }struk;
    >
    > which is uses in a method:
    >
    > test(struk a)
    > {
    > ...
    > }
    >
    >
    > now my problem:
    > how can i call this function from vb-script without getting an error?
    > do i have to define the struct in another way as here shown?
    > in c++ its easy, because i can call the struct directly...
    >
    > greetings,
    > claus


    Who knows, except to say that C++ won't allow that either.
    Structs don't exist. They are just blueprints, declarations.
    A struct is not called nor is it an object - in any language. An
    instance of a struct also can't be "called". An instance can be created
    / conceived by "invoking" the struct's constructor.
    You can *call* a function and pass it an instance by value, pointer or
    reference, assuming there is a corresponding blueprint somewhere for
    that function (a declaration).

    struct Whatever
    {
    int a;
    Whatever() : a(99) { }
    } instance;

    void test( Whatever& ref )
    {
    std::cout << ref.a << std::endl;
    }

    int main()
    {
    test( instance );
    }

    /*
    99
    */
    Salt_Peter, Oct 24, 2006
    #2
    1. Advertising

  3. Claus77

    Phlip Guest

    Claus77 wrote:

    > .idl file

    ....
    > how can i call this function from vb-script without getting an error?

    ....
    > in c++ its easy, because i can call the struct directly...


    This newsgroup is only qualified to discuss the raw C++ language itself, not
    all its platform-specific bindings.

    Tip: Don't use VBScript.

    And post this question to a COM newsgroup for best results!

    --
    Phlip
    http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
    Phlip, Oct 24, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexander Stippler

    Re: visibility of typedefs

    Alexander Stippler, Jun 24, 2003, in forum: C++
    Replies:
    5
    Views:
    815
    tom_usenet
    Jun 25, 2003
  2. emerth
    Replies:
    3
    Views:
    372
    emerth
    Aug 8, 2003
  3. dwrayment

    Templates and Typedefs

    dwrayment, Aug 12, 2003, in forum: C++
    Replies:
    6
    Views:
    394
    Sam Holden
    Aug 14, 2003
  4. Dave
    Replies:
    4
    Views:
    763
    Andrey Tarasevich
    Dec 5, 2003
  5. cppaddict

    too many typedefs

    cppaddict, Jun 19, 2004, in forum: C++
    Replies:
    2
    Views:
    348
    cppaddict
    Jun 19, 2004
Loading...

Share This Page