RE: [AD] Individual header dependency

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Title: RE: [AD] Individual header dependency

> I can't #include <allegro/gui.h> individually because gui.h includes
> gui.inl, which requires acquire_bitmap and release_bitmap to be
> defined, which are defined in gfx.inl. Trying to include gfx.inl
> before gui.inl doesn't work because gfx.inl depends on gfx.h.
> Is this a bug or a feature? I found this trying to pre-define DIALOG
> in one .h file where I didn't want to include the whole allegro.h.

So, basically, gui.h needs stuff from gfx.h. Unfortunate, and the
constant annoyance of inline functions, which mean you can't just
declare the functions. Allegro doesn't have clearly delimited areas
of API, so some stuff depends on some other stuff. Many things in
particular depend on the basic graphics stuff. I would not advocate
including inl files directly, they are just here to separate actual
declarations for definitions of inline routines. An inl file should
only be included by its corresponding header, IMHO. So, if gui.h
needs stuff from gfx.h, just include gfx.h before including gui.h.
Alternatively, and it may be better, include gfx.h from gui.h.

> BTW, I can't do 'void my_func(struct BITMAP *bmp)' because I get a
> warning from gcc saying that the struct is defined inside a parameter
> list. Putting 'struct BITMAP;' on a separate line before silences
> this. How is gcc so pedantic? Is it a bad idea to use the first
> idiom in header files? I remember doing that at work constantly to
> avoid including large header files and it worked ok...

If I understand right, this is only having to declare a type you
are using, no ? So this seems normal. Or am I missing something ?

--
Vincent Penquerc'h



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/