API's that certainly do work. [was; Re: Windows API calls that don't work? (Was RE: Stupid stupid question :/)

Colin Peters colin@bird.fu.is.saga-u.ac.jp
Wed Mar 26 17:32:00 GMT 1997


Jim Balter[SMTP:jqb@netcom.com] wrote:
>A. Phillip Smith wrote:
>> I would prefer to think that the other Smith didn't try to link
>> with the -lkernel32 library. In which case, things probably did
>> work for him. If he ever is inclined to repeat the test with that
>> library, I'm sure he'll agree that this is not a figment of our
>> collective imaginations, and we can end this thread.
>
>That may not be enough; if I understood Colin Peters correctly, he tried
>your example under win95 and it worked.  I would love to try it and
>put this (and brain-damaged DRS) to rest, but I don't have gnu-win32
>installed under win95.

In hopes of helping you end all this I'll come in and point out that
the example was compiled under Mingw32. However, that's not why my
attempt worked. Mine worked because the -lkernel32 on the command line
problem is a "known problem" for Mingw32 (listed on the web page). I
simply wasn't aware that it also happened to Cygwin32 users. The fact
that it does pleases me in a perverse way, because it means it's not
just my problem.

To summarize: The GNU-Win32 version of ld appears to have problems if
you link libkernel32 explicitly (e.g. by putting -lkernel32 on the gcc
command line). This may cause the executable to mysteriously fail under
Cygwin32 or produce a GP fault under Mingw32 (the difference is that
Mingw32 doesn't install it's own exception handler). These problems may
appear or disappear depending on whether certain functions (or numbers
of functions?) are linked from the Win32 API (possibly from kernel32?).

To summarize the summary: Don't link with -lkernel32 on your command
line.

Problem not solved, but at least there's a workaround.

Colin.

-- Colin Peters - colin@bird.fu.is.saga-u.ac.jp
-- Saga University Dept. of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html
-- http://www.geocities.com/Tokyo/Towers/6162/

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list