Dear i do not understand why the first example works and the second segfault. Thanks
----------------EXAMPLE 1 ------------------- // ldc2 -L=/usr/lib64/libXlib.so -L-lX11 -g -w xtest.d import std.string; import std.stdio; import std.conv; import std.c.stdlib : getenv; import std.exception : Exception; import X11.Xlib; void main( string[] args ){ Display* display = XOpenDisplay(getenv("DISPLAY")); if( display is null ) new Exception( "Could not communicate with X server" ); int counter; string pattern = "*\0"; char** fonts = XListFonts( display, pattern.dup.ptr, 10, &counter ); for(int c = 0; c < counter; c++) writeln( to!string( fonts[c] ) ); } ----------------EXAMPLE 2 ------------------- // ldc2 -L=/usr/lib64/libXlib.so -L-lX11 -g -w xtest.d import std.string; import std.stdio; import std.conv; import std.c.stdlib : getenv; import std.exception : Exception; import X11.Xlib; void main( string[] args ){ Display display = *XOpenDisplay(getenv("DISPLAY")); if( display is null ) new Exception( "Could not communicate with X server" ); int counter; string pattern = "*\0"; char** fonts = XListFonts( &display, pattern.dup.ptr, 10, &counter ); for(int c = 0; c < counter; c++) writeln( to!string( fonts[c] ) ); }