delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/10/20/05:41:14

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=sQ1Tr+ErNYNMkTKe
IfO9hoBT/Ct6v8dO6EiMN+Z6H0zvKKWWSAlEYmYnXPN+jpDMTIqZm80N4d+pifdh
oHOZ6/iXdVbZUxF2AiBBGkCi2UCQ6LubzGKBOgcSTChQwGCH5lhKVXMnZF2/rURB
TNWTCg6Og4hUhd/4FZ7/U/yIx8E=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=zMStZg6XqbHqqGPWfds5U7
1LELs=; b=gHclvwHjHn852OnnHJmKVtsDUA3TDLbC8AzEHIlNKVWxBVg87bO484
QIIS/Fp7zkEf7Trexl94+yX5m4VBAZ61/CsHLR2G7nwaz+Z/95mS+rr7Pq7WP/XK
jG+gxtJz3Y69CcCfUh64UeZADpTX2VXNSu2VmQLxP5TyqdxWIb8rU=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=listing, Csaba, mix, Raduly
X-HELO: mout.kundenserver.de
Subject: Re: How does linker choose library with same function export?
To: cygwin AT cygwin DOT com
References: <CALK-3m+4wh7eD5KyXAVAT7xYp=nhC9u=vzyOokS41U1GeVKWWQ AT mail DOT gmail DOT com> <CAEhDDbC9eOzZOhfYCvOoN0zpOkK9C4rr+GmvT1pb=1SLiVFbGQ AT mail DOT gmail DOT com>
From: Thomas Wolff <towo AT towo DOT net>
Message-ID: <9ac21380-a1d0-901b-81ae-5336ba240518@towo.net>
Date: Sun, 20 Oct 2019 11:40:16 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <CAEhDDbC9eOzZOhfYCvOoN0zpOkK9C4rr+GmvT1pb=1SLiVFbGQ@mail.gmail.com>
X-IsSubscribed: yes

Am 20.10.2019 um 11:15 schrieb Csaba Raduly:
> Hi,
>
> On Sat, Oct 19, 2019 at 2:57 PM Biswapriyo Nath  wrote:
>> I want to use socket() from ws2_32.dll file. But cygwin1.dll also has that
>> export. When I use `-lws2_32` option, will gcc **always** choose
>> ws2_32.lib? My query is somewhat similar with FAQ #5.11.
> I think the FAQ is pretty clear:
>
> "5.11.
>
> I don't want Unix sockets, how do I use normal Win32 winsock?
>
> You don't. "
I guess that should read "You don't, normally."
There may be reasons to look for special, Windows-supplied functionality 
variations, e.g. when interfacing to Windows (likely WSL, in this case).
Without the possibility to use a mix of POSIX and Windows APIs, the 
Cygwin Terminal (mintty) wouldn't exist.

For dedicated linking, I think the order of listing the libraries in the 
link command is essential.
If in doubt, you could also try to load the function dynamically from 
the desired library (using GetProcAddress for the Windows API or dlsym 
for POSIX).
Thomas

> You shouldn't look at Cygwin programs as if they were Windows programs.
> Cygwin is a POSIX environment.
> You either create a Cygwin program and use the POSIX functions,
> or you create a Windows program (you can cross-compile Windows programs
> under Cygwin).
> Mixing the two is likely to run into problems, and you aren't going to
> get much help
> when you were told "don't do it" at the very beginning.
>
> Csaba


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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