public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How does linker choose library with same function export?
@ 2019-10-19 12:56 Biswapriyo Nath
  2019-10-20  9:15 ` Csaba Raduly
  0 siblings, 1 reply; 3+ messages in thread
From: Biswapriyo Nath @ 2019-10-19 12:56 UTC (permalink / raw)
  To: cygwin

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.

--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How does linker choose library with same function export?
  2019-10-19 12:56 How does linker choose library with same function export? Biswapriyo Nath
@ 2019-10-20  9:15 ` Csaba Raduly
  2019-10-20  9:40   ` Thomas Wolff
  0 siblings, 1 reply; 3+ messages in thread
From: Csaba Raduly @ 2019-10-20  9:15 UTC (permalink / raw)
  To: cygwin list

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. "


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
-- 
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)

--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How does linker choose library with same function export?
  2019-10-20  9:15 ` Csaba Raduly
@ 2019-10-20  9:40   ` Thomas Wolff
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Wolff @ 2019-10-20  9:40 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-20  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-19 12:56 How does linker choose library with same function export? Biswapriyo Nath
2019-10-20  9:15 ` Csaba Raduly
2019-10-20  9:40   ` Thomas Wolff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).