# Environment Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. set DISPLAY=:0.0 # Set DISPLAY from cmd.exe window start xwin -multiwindow # Start XWin # Startup log for XWin Welcome to the XWin X Server Vendor: The Cygwin/X Project Release: 1.18.3.0 OS: CYGWIN_NT-6.1 Oceandrive 2.5.2(0.297/5/3) 2016-06-23 14:29 x86_64 OS: Windows 7 Service Pack 1 [Windows NT 6.1 build 7601] (Win64) Package: version 1.18.3-1 built 2016-06-20 XWin was started with the following command line: xwin -multiwindow xterm # Starts correctly # Compile code with following flags gfortran -g -fdollar-ok -c testxod.f gfortran -g -I/cygdrive/c/cygwin64/usr/include -I/cygdrive/c/cygwin64/usr/include/X11 -c isox11.c gfortran testxod.o isox11.o defmap.o bmp_comms.o read_cmap_params.o isoflush.o -o ../ISOPARIX/testxod.exe -L/cygdrive/c/cygwin64/lib -lX11 # # Try to open display from call to isox11.c inside testxod.f. Run under gdb # (gdb) run Starting program: /cygdrive/e/ISOPERF/ISOPARIX/testxod [New Thread 7856.0x1de0] [New Thread 7856.0x1eb8] ISOX11.C: x11winope about to connect to display :0.0 Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: [Thread 7856.0x1eb8 exited with code 3] [Inferior 1 (process 7856) exited with code 03] (gdb) q # Detail from the code around the failure point # # Relevant code lines # char *isodisplayname; Display *isodisplay isodisplayname=XDisplayName(NULL); (void)printf("ISOX11.C: x11winope about to connect to display %s\n",isodisplayname); # # Failure point # if((isodisplay=XOpenDisplay(isodisplayname))==NULL) { *rc=-1; *isocols=0; *maxcols=2; printf("ISOX11.C: x11winope: Failure in XopenDisplay etc etc"); return; }