Someone explain me this code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
In header file, I see this declaration:

#define DECLARE_VTBL(iname) iname vt##iname;

then, in C file, there are below codes:

typedef struct _Abc {
..........
} abc;
DECLARE_VTBL(abc)

I don't understant these code. Could someone explain me what it does?

Thanks
Tran Hong Quang
 
Tran Hong Quang said:
Hi,
In header file, I see this declaration:

#define DECLARE_VTBL(iname) iname vt##iname;

then, in C file, there are below codes:

typedef struct _Abc {
.........
} abc;
DECLARE_VTBL(abc)

The macro expands to:

abc vtabc;

Which will be a set of function pointers serving as the vtable (native
invocation, as opposed to dispatch invocation) for COM objects written in C.
In C++ they would be member functions and the compiler would create the
vtable.
 
Back
Top