COM typedefs

C

Claus77

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
 
S

Salt_Peter

Claus77 said:
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
*/
 
P

Phlip

Claus77 said:
.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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top