Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Reply-To: From: "Kris Thielemans" To: "Gnuwin" Subject: compiling X programmes and run-time crash Date: Thu, 27 Jan 2000 11:05:48 -0000 Message-ID: <000701bf68b6$777312f0$1d4bb392@petnt1.rpms.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2377.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 Importance: Normal Hi, I am trying to get a simple X programme running on cygwin B20.1, but can't even create a window. I have STATUS_ACCESS_VIOLATION crashes when trying to get the DefaultRootWindow for the display. Presumably I do something stupid wrong, but can't figure it out. (My X knowledge is rather old...). Here is the simplest code I could come up with: #include int main() { Display *SCX_display; Screen * defscr; Window rootwindow; /* Note: explicit use of $DISPLAY does not help */ /* SCX_display = XOpenDisplay ("localhost:0.0");*/ SCX_display = XOpenDisplay (NULL); if (!SCX_display) return 1; /* next is the equivalent of rootwindow = DefaultRootWindow(SCX_display); */ defscr = ScreenOfDisplay(SCX_display,DefaultScreen(SCX_display)); /* ACCESS VIOLATION in next line: defscr points to nonsense */ rootwindow = defscr->root; XCloseDisplay (SCX_display); return 0; } When I run gdb and examine *SCX_display, I see that nscreens=0 (SCX_display->nscreens = 'number of screens on this server' = ScreenCount(SCX_display)) I guess this 'explains' why the default screen is nonsense. But why is ScreenCount(SCX_display) == 0 ? Thanks for any help, Kris PS: More details I have NT4.0 sp6, cygwin B20.1, gcc 2.95.2, X11R6.4 (don't recall from where, sorry. I think it was Andy's (?) distribution, called x11-b20_tar.gz), and run Exceed 6.1 as X server. DISPLAY=localhost:0.0 Note that - I can run precompiled X programmes without problems (xterm, xclock...) (ok, I tested only those included in the X distribution) - the (full) programme works fine on a few Unix systems (even with a remote display to my NT system). screenshot: running gdb ----------------------- (gdb) p *SCX_display $1 = {ext_data = 0x0, free_funcs = 0xa032478, fd = 3, conn_checker = 0, proto_major_version = 11, proto_minor_version = 0, vendor = 0xa032570 "Hummingbird Communications Ltd.", resource_base = 4194304, resource_mask = 4194303, resource_id = 1, resource_shift = 0, resource_alloc = 0x670b12a0 <_size_of_stack_reserve__+1695224480>, byte_order = 1, bitmap_unit = 8, bitmap_pad = 32, bitmap_bit_order = 1, nformats = 3, pixmap_format = 0xa032598, vnumber = 11, release = 6100, head = 0x0, tail = 0x0, qlen = 0, request = 5, last_req = 0x5
, buffer = 0x671070ac "", bufptr = 0xa031c70 "b", bufmax = 0xa031c70 "b", max_request_size = 167978096, db = 0xffff, synchandler = 0, display_name = 0x0, default_screen = 167976000, nscreens = 0, screens = 0x1, motion_buffer = 167978448, flags = 1, min_keycode = 4, max_keycode = 8, keysyms = 0xfe, modifiermap = 0x0, keysyms_per_keycode = 0, xdefaults = 0x0, scratch_buffer = 0x0, scratch_length = 0, ext_number = 0, ext_procs = 0x0, event_vec = {0, 0x670b1dc8 <_size_of_stack_reserve__+1695227336>, 0x670b1dc8 <_size_of_stack_reserve__+1695227336>, 0x670b1de0 <_size_of_stack_reserve__+1695227360> , 0x670b1dc8 <_size_of_stack_reserve__+1695227336> }, screenshot: running gcc ----------------------- bash-2.02$ gcc -g -v testit.c -lX11 Reading specs from //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32 /2.95.2/specs gcc version 2.95.2 19991024 (release) //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/cpp.exe -l ang-c -v -iprefix //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/ 2.95.2/ -D__GNUC__=2 -D__GNUC_MINOR__=95 -Di386 -D_WIN32 -DWINNT -D_X86_=1 - D__S TDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__ cdec l__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D_WIN32 -D__WINNT__ -D_ X86_ =1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribu te__ ((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386 -D__WINNT -Asystem (win nt) -Acpu(i386) -Amachine(i386) -g -remap -Acpu(i386) -Amachine(i386) -Di386 -D_ _i386 -D__i386__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentiu m__ -D__CYGWIN32__ -D__CYGWIN__ testit.c c:\tmp/cc41L4EW.i GNU CPP version 2.95.2 19991024 (release) (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/../../. ./. ./../include //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/../../. ./. ./i586-cygwin32/include //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/include /usr/X11R6.4/include /usr/local/include /usr/include End of search list. The following default directories have been omitted from the search path: /Cygnus/cygwin-b20/H-i586-cygwin32/lib/gcc-lib/i586-cygwin32/2.95.2/../../.. /.. /../include/g++-3 End of omitted list. //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/cc1.exe c: \tmp/cc41L4EW.i -quiet -dumpbase testit.c -g -version -o c:\tmp/ccJOfNLn.s GNU C version 2.95.2 19991024 (release) (i586-cygwin32) compiled by GNU C versio n 2.95.2 19991024 (release). //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/../../. ./. ./i586-cygwin32/bin/as.exe -o c:\tmp/ccSiQ1Qg.o c:\tmp/ccJOfNLn.s //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/collect 2.e xe //e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/../../. . /../i586-cygwin32/lib/crt0.o -L//e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-l ib/i 586-cygwin32/2.95.2 -L//e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc-lib -L/usr /X11 R6.4/lib -L. -L/usr/local/lib -L//e/cygnus/CYGWIN~1/H-I586~1/bin/../lib/gcc- lib/ i586-cygwin32/2.95.2/../../../../i586-cygwin32/lib -L//e/cygnus/CYGWIN~1/H-I 586~ 1/bin/../lib/gcc-lib/i586-cygwin32/2.95.2/../../.. c:\tmp/ccSiQ1Qg.o -lX11 -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc ------------------------------------- Kris Thielemans (kris DOT thielemans AT ic DOT ac DOT uk) MRC Cyclotron Unit, Hammersmith Hospital, DuCane Rd,London W12 0NN, United Kingdom Phone on : +44 (020)8383 3731 FAX on : +44 (020)8383 2029 http://cu.rpms.ac.uk/~kris -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com