I am developing a simple library in C, for my own + some friends personal use.
I am currently having a C structure with some members that should be somehow hidden fr
I agree with Marcelo Cantos, but also suggest simply adding a pointer inside the "public" structure, which points to the "private" contents, i.e:
/* foo.h */
typedef struct Bar Bar;
typedef struct Foo
{
int public;
Bar* private;
} Foo;
Foo *foo_create(...);
void foo_bark(Foo* foo, double loudness);
/* foo.c */
struct Bar
{
int private_var;
};
This approach is kind of like the "pimpl" ideom. The simplest approach by far is to do what Marcelo Cantos suggested.