How does linker choose library with same function export?

Csaba Raduly rcsaba@gmail.com
Sun Oct 20 09:15:00 GMT 2019


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



More information about the Cygwin mailing list