OiO.lk Blog C# how to get rid of circular dependencies in C
C#

how to get rid of circular dependencies in C


I’m new to C and I’m stuck on this problem. In C# doing something like this is perfectly ok but in C the compiler works different and it needs to know the type definitions before hand.

struct FN;

typedef struct {
    void (*create) (FN *fn);
} Window;

typedef struct 
{
    Window window;
} 
FN;

Is there some kind of C trick with pointers etc that I can use to get it working? I’m trying to create like a "manager" class where I can call functions on my modules and then just pass the manager around where needed.



You need to sign in to view this answers

Exit mobile version