问候-与C ++库相关 [英] Regards - Related to C++ library

查看:76
本文介绍了问候-与C ++库相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能建立一个不与任何静态库链接的动态库?

Should it be possible to make a dynamic library that does not link with any static library?

推荐答案

从技术上讲,是的:但是您必须满足这些要求

  • 您的代码必须是自包含的(不需要使用语言库函数)
  • 如果需要某些OS API,则必须动态导入操作系统DLL(通过LoadLibrary和GetProcAddrss)
  • 您的语言必须不需要初始化前或终止后的代码(C ++不适合此操作,除非禁用这些功能,但这意味着没有静态和全局对象",因为它们不会正确构造/删除)
  • 您的编译器必须能够生成用于代码构造的代码(切勿在某些运行时库函数调用中对其进行翻译:C ++有时需要CRT,C可以不使用CRT,但只能在特定条件下使用:无FILE操作)
Technically yes: but you must meet these points

  • your code must be self-cotained (no need to use language libraty functions
  • If you need some OS API, you must import dynamically the operating system DLL (via LoadLibrary and GetProcAddrss)
  • Your language must not require pre-initialization or post-termination code. (C++ is not suitable for that, unless disabling those features, but this means "no static and global objects", since they will not be properly constructed / deleted
  • Your compiler must be able to generate code forwatever construct (never translate it in some runtime-library function call: C++ sometimes require the CRT, C can do without it, but only in certain condiction: no FILE operation)


默认情况下,是不是DLL?


Hm, dll不会链接到任何静态库,除非您建议这样做...
Hm, a dll does not link to any static library unless you advise it to do so...


这篇关于问候-与C ++库相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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