delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/09/27/09:44:20

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Importance: Normal
Subject: Re: Linking in WSAGetLastError
To: DJ Delorie <dj AT delorie DOT com>
Cc: cygwin AT sourceware DOT cygnus DOT com
X-Mailer: Lotus Notes Release 5.0.3 (Intl) 21 March 2000
Message-ID: <OF0218AED7.F7BEE650-ON85256967.0048A37B@raleigh.ibm.com>
From: "Ed Bradford/Raleigh/IBM" <egb AT us DOT ibm DOT com>
Date: Wed, 27 Sep 2000 09:42:43 -0400
X-MIMETrack: Serialize by Router on D04NMS90/04/M/IBM(Release 5.0.3 (Intl)|21 March 2000) at
09/27/2000 09:43:00 AM
MIME-Version: 1.0

I'm missing something here. If the CYGWIN libraries don't export functions
(aren't current with MS API's) then
you simply can't use the function. At least that's what I thought. After a
few simple experiments, I find that I might be wrong. Is there something
written somewhere that describes the relationship between
     gcc msg.c
and the Microsoft libraries? For instance, using gcc -v I see no references
to the mssdk libraries. Is that
because there isn't any? Here is my simple "msg.c" program:

     #include <windows.h>

     int main(int ac, char *av[])
     {
          MessageBox(NULL, "Messsage", "Title", MB_OK);
          return 0;
     }

It compiles with either
     cl msg.c user32.lib -o msg-cl.exe
or
     gcc msg.c -o msg-gcc
Both compile, link and execute properly. More precisely,

   gcc -c msg.c
   ld -Bdynamic /lib/crt0.o msg.o -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2
   -luser32 -lcygwin -lkernel32

produces a correctly working executable. Here, all the "-l" things refer to
/lib/libXXX.a modules. Substituting
//e/mssdk/lib/user32.lib for the "-luser" in the ld line, results in an
undefined reference to MessageBoxA
which is what I would expect.

As you can see, I am a bit confused. Any pointers to writeups on how all
the gcc libraries and
Windows libraries fit together would be greately appreciated. Also, I
wouldn't mind writing some of this
up once I understand it.

Thank you
Ed Bradford



Your Windows 2000 Arborist
T/L 589-4410; Outside: 1-919-993-4410
egb AT us DOT ibm DOT com


DJ Delorie <dj AT delorie DOT com>@sources.redhat.com on 09/26/2000 09:33:12 PM

Sent by:  cygwin-owner AT sources DOT redhat DOT com


To:   olson AT cs DOT odu DOT edu
cc:   cygwin AT sourceware DOT cygnus DOT com
Subject:  Re: Linking in WSAGetLastError




> conf.o(.text+0x2c74):conf.c: undefined reference to `WSAGetLastError'

They don't export WGAGetLastError.  They export WSAGetLastError AT 0.
This means that you aren't including the proper headers (winsock.h),
and it's defaulting to cdecl instead of stdcall (WINAPI) calling
conventions.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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