Mail Archives: cygwin/1998/09/05/02:20:55
Hi folks,
On 2 Sep 98, at 19:30, the Illustrious Colin Peters wrote:
Thanks for the quick reply Colin, it is appreciated.
> Paul Garceau <pgarceau AT teleport DOT com> wrote:
> > Under EGCS-Mingw32, why is it necessary to add a -l reference for
> > User32 for a command such as:
> >
> > gcc test.c -o test.exe
> >
> > in order to generate a successful link?
>
>
> (Assuming test.c uses some functions from the user32 DLL.) This is because
> the only Win32 API library included by default in Mingw32 is kernel32
> (it's needed by the startup code).
Ah hah! (a light dawns in an otherwise ding(e)y room...)
> If you are writing a program that uses
> other API functions then you need to link in the API libraries explicitly.
Ok.
> Now, if you are writing a GUI program you can use -mwindows and you will
> automatically get user32 and a few other basic Win32 API libraries.
> It was
> done this way because GUI programs usually use the Win32 API, so it makes
> sense to do the extra library linking.
Agreed.
> (Note: you can't do "gcc -o
> test.exe test.c -mwindows" because the windows option will get sent to the
> compiler as well as the linker, and the compiler doesn't understand it, so
> you have to compile first and then link with -mwindows.)
Ok, so in the linking phase is when -mwindows needs to be referenced,
not during the compile itself.
>
> I suppose we could just include all those libraries by default all the
> time, though I don't think it makes much difference once you understand
> what's going on.
I agree, it doesn't make sense if one knows what's going on...thanks
again, Colin.
Peace,
Paul G.
Information Systems Consultant
NewDawn Productions
http://www.teleport.com/~pgarceau/newdawn/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -