I am trying to create a structure by the name "IExampleVtbl" that will hold a pointer to my functions (SetStringPtr,GetStringPtr) and will be a part of another structure "IExample".
But I want to pass the other structure "IExample" as parameter to the functions (SetStringPtr,GetStringPtr).
This is the code:
#include <windows.h>
#include <stdio.h>
typedef struct {
SetStringPtr *SetString;
GetStringPtr *GetString;
} IExampleVtbl;
typedef struct {
IExampleVtbl *lpVtbl;
DWORD count;
char buffer[80];
} IExample;
typedef long SetStringPtr(IExample *, char *);
typedef long GetStringPtr(IExample *, char *, long);
long SetString(IExample *this, char * str)
{
...
return(0);
}
long GetString(IExample *this, char *buffer, long length)
{
...
return(0);
}
As you can see the first structure need to know about the functions, the functions need to know about the second structure which need to know about the first structure.
How I can solved that?