AW: Solving a dependency circle

"Christian, Martin, OPEE45" <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
Unfortunately it still doesn't work! I tried to emulate gcc:

1.) main -> Beta:
    + BETA_H_ is defined
2.) Beta -> Alpha:
    + ALPHA_H_ is defined
    + Alpha is parsed
3.) Alpha -> Alpha_inline:
    + ALPHA_INLINE_H_ is defined
    + Alpha is ignored, because ALPHA_H_ is set
    + Beta is ignored, because BETA_H_ is set
-> Error because Beta is needed

Maybe it helps, if I rearrange Alpha and Beta?!

Cheers,

Martin.

-----Ursprüngliche Nachricht-----
Von: Espen Skoglund [mailto:[email protected]] Im Auftrag von Espen Skoglund
Gesendet: Dienstag, 23. Januar 2007 19:53
An: Christian, Martin, OPEE45
Cc: [email protected]
Betreff: Re: Solving a dependency circle

[Martin Christian]
> This is not really a L4 question! However, it's a real problem for me,
> while adapting the PowerPC arch to NICTAs L4.N1 API. The include files
> create a circle of dependency. There are common solutions to this,
> however this ones seems to be special or at least out of my mind.

> I created this simple example:

> <main.cpp>
> #include "Beta.h"

> int main( int argc, char** argv ) {
> 	Beta b;

> 	b.useInline();
> 	return 0;
> }
> </main.cpp>

> Compile with: gcc -Wall main.cpp -o dependency

> The solution would be to include "Alpha_inline." in
> main.cpp. However, the file belongs to the "API", which means I
> can't change it.

As far as I can see from your example, including Alpha_inline.h in
Alpha.h at end of the file instead of the beginning would also solve
the problem.

	eSk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.