X header help

John Reimer terminal.node at gmail.com
Sat Mar 11 23:11:06 PST 2006


Lucas Goss wrote:
> Has anyone translated X C headers to D? I have X.h done and Xlib.h is 
> partly done.
> 
> Anyways, I've run into some code that I'm not sure how to translate it 
> to D.
> 
> //----------
> typedef void (*XIMProc)(
>     XIM,
>     XPointer,
>     XPointer
> );
> 
> // then later a struct which uses the above function pointer
> 
> typedef struct {
>     XPointer client_data;
>     XIMProc callback;
> } XIMCallback;
> //----------
> 
> I translated the it as:
> //----------
> void function(XIM, XPointer, XPointer) XIMProc;
> 
> struct XIMCallback
> {
>     XPointer client_data;
>     // XIMProc callback; ??? nope.
>     // void* callback = XIMProc(); ??? nope.
> }
> //----------
> 
> Obviously it failed to compile, but I'm not sure how to translate it.


These headers could be quite useful!  Please submit them to the D 
bindings project at dsource.org when you are done?  I could use them in 
a project or two in the future. :)

-JJR



More information about the Digitalmars-d mailing list