I am trying to create a structure called "IExampleVtbl" that will contain a pointer to my functions (SetStringPtr, GetStringPtr) and will be part of another "IExample" structure .
But I want to pass another "IExample" structure as a 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 must know about the functions, the functions must know about the second structure, which must know about the first structure.
How can i solve this?