问题
I'm using Winsock 1.1 in my project. I include wsock32.lib
in "Additional Dependencies".
I'm looking at the DLL project using depends.exe
and notice that the DLL depends on wsock32.dll
. How can I statically link it so that it doesn't depend on wsock32.dll
?
回答1:
The short answer is that you can't. There is no static winsock library, you can only invoke wsock32.dll. Much the same way that you can't statically link to user32 or kernel32. There are things with wsock32.dll internally that are necessarily different on different versions of Windows, and even different service packs on the same versions of Windows, so statically linking would be a bit of a nightmare.
wsock32.dll is present on all versions of Windows that have TCP/IP installed, though, with the same interface, so there wouldn't be any benefit from statically linking anyway.
来源:https://stackoverflow.com/questions/1692472/statically-linking-winsock