Skip to content

Instantly share code, notes, and snippets.

@jvranish
Created December 15, 2011 14:16
Show Gist options
  • Save jvranish/1481228 to your computer and use it in GitHub Desktop.
Save jvranish/1481228 to your computer and use it in GitHub Desktop.
#ifndef MODULEA_H
#define MODULEA_H
#include "moduleB.h"
typedef struct
{
...
} ModuleAType;
void SomeFunctionA(ModuleAType* a, ModuleBType* b);
#endif /* MODULEA_H */
#ifndef MODULEB_H
#define MODULEB_H
#include "moduleA.h"
typedef struct
{
ModuleAType someField; // <----- this is the tricky bit
} ModuleBType;
void SomeFunctionB(ModuleAType* a, ModuleBType* b);
#endif /* MODULEB_H */
#ifndef MODULEB_H
#define MODULEB_H
#include "moduleA.h"
struct ModuleBType_s;
typedef struct ModuleBType_s ModuleBType;
void SomeFunctionB(ModuleAType* a, ModuleBType* b);
#endif /* MODULEB_H */
#ifndef MODULEB_TYPES_H
#define MODULEB_TYPES_H
#include "moduleA.h"
struct ModuleBType_s
{
ModuleAType someField;
};
#endif /* MODULEB_TYPES_H */
#include "moduleA.h"
...
#include "moduleA.h"
#include "moduleB_types.h"
...
typedef struct
{
ModuleAType someField; // <----- this is the tricky bit
} ModuleBType;
void SomeFunctionB(ModuleAType* a, ModuleBType* b);
typedef struct
{
...
} ModuleAType;
void SomeFunctionA(ModuleAType* a, ModuleBType* b);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment