Re: Problem with interfacing C code to D

2012-01-09 Thread Andrej Mitrovic
Scratch that, in X11 apparently the Display structure is an incomplete type (so sizeof won't work). This means you most probably *have* to use pass it around as an opaque pointer. It's kind of odd because you can still access some of its fields (so it's not totally opaque), but you can't do copies.

Re: Problem with interfacing C code to D

2012-01-09 Thread Artur Skawina
On 01/10/12 01:02, bioinfornatics wrote: > Dear i do not understand why the first example works and the second > segfault. Thanks > > EXAMPLE 1 --- Display* display = XOpenDisplay(getenv("DISPLAY")); > char** fonts = XListFonts( display, pattern.dup.ptr,

Re: Problem with interfacing C code to D

2012-01-09 Thread Andrej Mitrovic
Jesus christ, sorry about that my keyboard script went crazy and posted that. What I was going to say is it's likely a mismatch of the struct sizes. In the second example you are dereferencing the pointer on the D size, which does a field-by-field copy of the pointed-to struct. But D will only rea

Re: Problem with interfacing C code to D

2012-01-09 Thread Andrej Mitrovic
It's likely a module Gmail - Problem with interfacing C code to D - Mozilla Firefo; import std.algorithm; import std.array; import std.stdio; void main() { } On 1/10/12, bioinfornatics wrote: > Le mardi 10 janvier 2012 à 01:26 +0100, Trass3r a écrit : >> What's the definition of Display? > >

Re: Problem with interfacing C code to D

2012-01-09 Thread bioinfornatics
Le mardi 10 janvier 2012 à 01:26 +0100, Trass3r a écrit : > What's the definition of Display? This one: _ struct _XDisplay{ XExtData* ext_data; /* hook for extension to hang data */ _XPrivate* private1;

Re: Problem with interfacing C code to D

2012-01-09 Thread Trass3r
What's the definition of Display?