View previous topic :: View next topic |
Author |
Message |
just free man
Joined: 25 Jul 2007 Posts: 4
|
Posted: Tue Aug 07, 2007 5:30 am Post subject: System for simple interaction with C libraries |
|
|
Hi all!
I think that will be very sweet simple using C libraries from D source files, like C++ #include.
Stages of compiling D source that uses C libraries:
- Extracting headers names from D sources. Specially program will do it. Directive like
can be converted to header name
Code: | c.X11.Xlib as <X11/Xlib.h> |
If our header is unordinary, import directive will look like
Code: | import c.mypicture /*#from "../mypicture.xpm"*/; |
and preprocessed to
Code: | c.mypicture as "../mypicture.xpm" |
Converting this headers to D files. We can use h2d or bcd.
What do you think about it? |
|
Back to top |
|
|
just free man
Joined: 25 Jul 2007 Posts: 4
|
Posted: Tue Aug 07, 2007 5:33 am Post subject: |
|
|
Now d-extract-headers program that extracts headers names from D source is almost done. |
|
Back to top |
|
|
just free man
Joined: 25 Jul 2007 Posts: 4
|
Posted: Tue Aug 07, 2007 9:56 am Post subject: |
|
|
I think: why not make custom directives contains ordinary c preprocessor directives and mark that using special comment prefix:
Code: | import c.mypicture /*@cpp@ #include "../mypicture.xpm" */; |
Then we can get support for useful defines/includes before headers:
Code: | import c.mymodule /*@cpp@ #define NDEBUG
#include "config.h"
#include <mymodule.h> */;
|
Text of preprocessor directives will be copied to master header, that will be preprocessed by h2d, bcd or other .h to .d convertor.
Every suggestions welcom (especially about syntax). |
|
Back to top |
|
|
|