[cfe-dev] Translate C includes to Java-like imports

Jacob Carlborg doob at me.com
Sat Oct 9 02:26:21 PDT 2010


I'm working on source to source translator which translates 
Objective-C/C header files to D files. I've encountered a problem and 
that is how the include system works in the two languages. The import 
system in D works more like it does in Java than in C. For example:

If I have three files:

* A.h, includes B.h
* B.h, includes C.h
* C.h

In C (the language) A.h would have access to everything in B.h and C.h 
as well. In D this is not the case, I would have to explicitly import 
both B.h and C.h to access it from A.h. So I guess the question is: for 
a given type, typedef or similar how can I determine where it's declared 
and if the file that it's declared in are already included or not?

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list