> I do implement a purely functional API with my project. A gl_list_t is
> never used by the user
> and is instead wrapped inside of a structure defined by me. All API
> functions operate on said
> data structure instead of using a gl_list_t structure.
Good, fine.
> My problem is that the header file in which this data type is defined
> includes gl_list.h. When I try
> removing this include statement, the gl_list_t type is undeclared and
> throws and error.
There are at least two ways to solve it:
a) Put the declaration of the data type in a private header file.
E.g. foo.h:
struct foo;
int bar (struct foo *);
foo-private.h:
#include <foo.h>
#include "gl_list.h"
struct foo { ...; gl_list_t member; ... };
b) Use 'struct gl_list_impl *' instead of gl_list_t, since that what it really
is.
E.g. foo.h:
struct gl_list_impl;
struct foo { ...; struct gl_list_impl * member; ... };
int bar (struct foo *);
foo-private.h:
#include <foo.h>
#include "gl_list.h"
Bruno