Statically linking Winsock?

為{幸葍}努か 提交于 2020-12-30 03:48:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!