Hi, all. I'm studying Kerrisk's The Linux Programming Interface for fun. The book is written in C, and I thought it would be fun to do the exercises in D. My problem is that I'm doing things like
#include <sys/types.h>
in my C code and that loads oodles of macros like ssize_t, O_RDONLY, EXIT_SUCCESS, etc.

I don't mind writing .di files for the occasional function I use, but tracking down every last typedef and #define is going to be a hassle. The functions aren't bad because you can just make a C file that #includes all the libraries you want, cc it to lib.o then write a .di that uses the functions you want from that mammoth. Extracting the #defines and typedefs from stdlib.h (and everything it includes) sounds, uh, daunting. (this suspicion is corroborated by Deimos, which has no commits to the libc repository)

I was thinking it wouldn't be too bad if I could write a .c file that somehow conveniently boxes up the relevant information for a .di file to extract it, but I'm at a loss for where to go with this.

Alternatively, I could maybe run the .di file through gcc for preprocessing only and hope that I don't confuse its lexer.

Has anyone here had any experience with these things?

Reply via email to