静态链接Winsock? [英] Statically linking Winsock?

查看:49
本文介绍了静态链接Winsock?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中使用Winsock 1.1.我在其他依赖项"中包含了 wsock32.lib .

我正在使用 depends.exe 查看DLL项目,并注意到DLL依赖于 wsock32.dll .我如何静态链接它,使其不依赖于 wsock32.dll ?

解决方案

简短的答案是你做不到.没有静态的winsock库,您只能调用wsock32.dll.无法静态链接到user32或kernel32的方式几乎相同.内部存在wsock32.dll的东西在不同版本的Windows上甚至一定是不同的,甚至在相同版本的Windows上甚至不同的Service Pack也是如此,因此静态链接会有些噩梦.

wsock32.dll存在于安装了TCP/IP的所有Windows版本中,并且具有相同的接口,因此无论如何静态链接都不会带来任何好处.

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?

解决方案

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.

这篇关于静态链接Winsock?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆