如何静态链接Indy SSL文件? [英] How to statically link Indy SSL files?

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

问题描述

如何静态链接Indy OpenSLL文件? AFAIK只有ICS允许这个,但是有些奇怪的原因Indy没有。它也不提供.obj文件?这将允许我避免对dll的任何依赖。

解决方案

OpenSSL主要是为了动态使用。当新的OpenSSL版本被发布时,这样可以轻松升级。然而,OpenSSL也可以静态编译,Indy 10.6.0+支持静态链接到OpenSSL,但目前只支持在iOS设备上(因为Apple不允许OpenSSL动态链接)。在所有其他平台(包括iOS模拟器)上,Indy默认链接到OpenSSL。如果您希望Indy在非iOS平台上静态链接到OpenSSL,则必须手动设置:


  1. 编译/为您的目标平台获取OpenSSL的静态.lib / .a文件(iOS的静态.a文件在Indy的


  2. 更新Indy的IdCompilerDefines.inc文件以定义 USE_OPENSSL STATICLOAD_OPENSSL 为您的目标平台。


  3. 添加 IdSSLOpenSSLHeaders_static 单位到您的使用子句。


  4. 确保 IdSSLOpenSSLHeaders_static.pas 为您的目标平台编译(目前为iOS设计),因此您可能需要调整这个选项是根本不使用OpenSSL,但使用另一个SSL / TLS库,可以是静态链接并由适合的<$ c $包裹c> TIdSSLIOHandlerSocketBase 实现为Indy使用。例如, EldoS SecureBlackbox 为其SSL / TLS库提供了此类实现。在未来,Indy计划在Windows上为SChannel添加一个新的IOHandler实现,因为它们已经安装在操作系统中,因此不需要分发DLL。


    How can I statically link Indy OpenSLL files? AFAIK only ICS allows this but for some weird reason Indy doesn't. Neither does it provide .obj files? This will allow me to avoid any dependency on the dll's.

    解决方案

    OpenSSL is primarily meant to be used dynamically. That allows for easy upgrades when new OpenSSL versions are released. However, OpenSSL can be compiled statically as well, and Indy 10.6.0+ does support linking to OpenSSL statically, but currently only supports that on iOS devices (because Apple does not allow OpenSSL to be linked dynamically). On all other platforms (including the iOS simulator), Indy links to OpenSSL dynamically by default. If you want Indy to link to OpenSSL statically on non-iOS platforms, you will have to set it up manually:

    1. compile/obtain static .lib/.a files for OpenSSL for your target platform(s) (static .a files for iOS are provided at Indy's Fulgan mirror).

    2. update Indy's IdCompilerDefines.inc files to define USE_OPENSSL and STATICLOAD_OPENSSL for your target platform(s).

    3. add the IdSSLOpenSSLHeaders and IdSSLOpenSSLHeaders_static units to your uses clause.

    4. make sure IdSSLOpenSSLHeaders_static.pas compiles for your target platform(s) (it is currently designed for iOS, so you may need to tweak it).

    The alternative is to not use OpenSSL at all, but use another SSL/TLS library that can be statically linked and is wrapped by a suitable TIdSSLIOHandlerSocketBase implementation for Indy to use. EldoS SecureBlackbox, for instance, provides such an implementation for its SSL/TLS library. And in the future, Indy is planning on adding a new IOHandler implementation for SChannel on Windows, which does not require distributing DLLs since they are already installed in the OS.

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

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