www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/03/27/18:44:15

From: jqb AT netcom DOT com (Jim Balter)
Subject: A final word on -lkernel32
27 Mar 1997 18:44:15 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <3339F54A.5C14.cygnus.gnu-win32@netcom.com>
Mime-Version: 1.0
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

For those who have been having trouble following the discussion and
examples regarding the -lkernel32 bug that Phil Smith encountered:

Using gcc ... -lkernel32 on some systems with some code will cause
that code to fail, when not including -lkernel32 will not.
It isn't necessary to include -lkernel32, because under b17 gcc
automatically includes it.  I am intentionally being vague about
the circumstances, because I don't want to overstate the case
since I cannot conclusively test all cases.  Here is a somewhat
minimal case that fails on my Win NT 4.0 system with service pack 2.
It is the same as a previous example I posted, but avoids an
irrelevant objection about an irrelevant warning about a prototype.
This is verbatim cut and paste from my console window:


/tmp$ cat >>mytest.c
#include <windows.h>
int STDCALL
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
{
        return 0;
}

HANDLE ThisIsNeverCalled(void)
{
        return GetModuleHandle(0);
}
^Z
/tmp$ gcc -o good mytest.c
/tmp$ ./good
/tmp$ gcc -o bad mytest.c -lkernel32
/tmp$ ./bad
(bad.exe 1353) In cygwin_except_handler
(bad.exe 1353) Exception trapped!
(bad.exe 1353) exception C0000005 at 40FC
(bad.exe 1353) exception: ax 400000 bx 400000 cx 0 dx 40205C
(bad.exe 1353) exception: si 243F5B8 di 100114F3 bp 243F5A4 sp 243F598
(bad.exe 1353) exception is: STATUS_ACCESS_VIOLATION
(bad.exe 1353) Stack trace:
(bad.exe 1353) frame 0: sp = 0x243F3C8, pc = 0x10012D72
(bad.exe 1353) frame 1: sp = 0x243F3E8, pc = 0x77F94492
(bad.exe 1353) frame 2: sp = 0x243F40C, pc = 0x77F88E93
(bad.exe 1353) frame 3: sp = 0x243F498, pc = 0x77F76202
(bad.exe 1353) frame 4: sp = 0x243F5A4, pc = 0x10011DE4
(bad.exe 1353) frame 5: sp = 0x243FF9C, pc = 0x10011DF7
(bad.exe 1353) frame 6: sp = 0x243FFA8, pc = 0x4010F4
(bad.exe 1353) frame 7: sp = 0x243FFB8, pc = 0x401012
(bad.exe 1353) frame 8: sp = 0x243FFC0, pc = 0x77F1B26B
(bad.exe 1353) frame 9: sp = 0x243FFF0, pc = 0x0
(bad.exe 1353) End of stack trace
/tmp$
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019