FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

System for simple interaction with C libraries

 
Post new topic   Reply to topic     Forum Index -> Potential Projects
View previous topic :: View next topic  
Author Message
just free man



Joined: 25 Jul 2007
Posts: 4

PostPosted: Tue Aug 07, 2007 5:30 am    Post subject: System for simple interaction with C libraries Reply with quote

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:

  1. Extracting headers names from D sources. Specially program will do it. Directive like
    Code:
    import c.X11.Xlib;

    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"

  2. Converting this headers to D files. We can use h2d or bcd.


What do you think about it?
Back to top
View user's profile Send private message
just free man



Joined: 25 Jul 2007
Posts: 4

PostPosted: Tue Aug 07, 2007 5:33 am    Post subject: Reply with quote

Now d-extract-headers program that extracts headers names from D source is almost done.
Back to top
View user's profile Send private message
just free man



Joined: 25 Jul 2007
Posts: 4

PostPosted: Tue Aug 07, 2007 9:56 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Potential Projects All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group