Proof of concept: automatically import C header files
Jacob Carlborg
doob at me.com
Wed Jul 17 23:21:28 PDT 2013
On 2013-07-17 21:40, Walter Bright wrote:
> Yes, but the front end itself must be complete. Otherwise,
> it's not really practical when you're dealing with things like the
> preprocessor - because a non-compliant front end won't even know it has
> gone off the rails.
>
> There are other issues when dealing with C .h files:
>
> 1. there may be various #define's necessary to compile it that would
> normally be supplied on the command line to the C compiler
>
> 2. there are various behavior switches (see the PR for DMD that wants to
> set the signed'ness of char types)
>
> 3. rather few .h files seem to be standard compliant C. They always rely
> on various compiler extensions
>
> These problems are not insurmountable, they just are non-trivial and
> need to be handled for a successful .h file importer.
Yes, I agree with all the above. That's why I'm using libclang. What I'm
saying is that when I use a library like libclang I can choose quite
freely what to convert and not convert. Example, DStep doesn't handle
the preprocessor at all. But since libclang does, it can parse any
header file anyway. What happens is just that the preprocessor
declarations won't be translated and not end up in the translated file.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list