please help me with following problem.
I have a.c which includes a.h
i have b.c which includes b.h
i have b.h which includes c.h (c.lib included)
a.c uses some functions which are defined in c.lib.
so i included b.h in a.h therby including c lib functions.
but iam writing something like hardware abstraction layer.
I dont want a.c access c.lib functions directly.
One way is to include c.h in b.c instead of b.h
What would be the standard pro way to do this.
Please help me. (using visual studio 2010 express on windows 7)
Why does b.h need to include c.h ?
b.c can include both b.h and c.h
I can see that one reason for the problem might be if some functions defined
in b.h have as arguments structures (let me call one 'struct XYZ') which are
defined in c.h. The standard way to handle this in C++ (I'm rusty on
what's allowed in C) is to make sure the b.h function arguments are
references or pointers to the structures, and then provide forward
definitions at the start of b.h like
so that it knows that XYZ is a structure name, and that the implementation
in b.c will get the details from another header (in this case c.h). Then
b.h does not need to include c.h
-- David Webber
Mozart Music Software