this implementation is easy to find if you are on Windows. [COM related] when you compile myfile.idl by MIDL compiler, a new file myfile.h will be generated. this file has implementation of C style virtual function. For exaple,
//myfile.h
typedef struct Iaa1Vtbl
{
long ( *AddRef )( Iaa1 * This);
} Iaa1Vtbl;
struct Iaa1{ struct Iaa1Vtbl *lpVtbl;};
long AddRef(){ cout<<"do nothing"<<endl; return 12345;}
[code presented without test]
as I know, virtual function is in scope of C++, it is used for Inheretance and Polymophism, so why you need them in C. you are doing the work of C++ compiler.
//myfile.h
typedef struct Iaa1Vtbl
{
long ( *AddRef )( Iaa1 * This);
} Iaa1Vtbl;
struct Iaa1{ struct Iaa1Vtbl *lpVtbl;};
long AddRef(){ cout<<"do nothing"<<endl; return 12345;}
[code presented without test]
as I know, virtual function is in scope of C++, it is used for Inheretance and Polymophism, so why you need them in C. you are doing the work of C++ compiler.