什么是关于对Linux共享库的良好做法? [英] What are good practices regarding shared libraries on Linux?

查看:153
本文介绍了什么是关于对Linux共享库的良好做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我读了很多关于Linux共享库,这里是我学到了什么:

I recently read a lot about shared libraries on Linux, and here is what I learnt:


  • 共享库应该嵌入的soname 包括它的主版本号。喜欢的东西:文件libfoo.so.1

  • 它的实际文件名也应该包括一个小版本号。喜欢的东西: libfoo.so.1.0

  • 当库文件被复制到,说的/ usr / local / lib目录,如果 ldconfig的运行,它会读取的soname 并创建一个名为文件libfoo.so.1 的符号链接指向 libfoo的.so.1.0

  • 如果一个人想使用这个库为它的发展首先应该没有任何版本号创建一个符号链接到真正的文件,说 libfoo.so 指向 libfoo.so.1.0 。这通常是由发展的包(当库打包在一起)。
  • 完成
  • A shared library should embed a soname including its major version number. Something like: libfoo.so.1
  • Its real filename should also include a minor version number. Something like: libfoo.so.1.0
  • When the library file is copied to, say /usr/local/lib, if ldconfig is run, it will read the soname and create a symlink named libfoo.so.1 pointing to libfoo.so.1.0.
  • If one wants to use this library for its developments it should first create a symlink without any version number to the real file, say libfoo.so pointing to libfoo.so.1.0. This is usually done by the development package (when the library is packaged).

这是正确的?

推荐答案

推荐阅读:

乌尔里希Drepper如何写共享库:<一href=\"http://www.akkadia.org/drepper/dsohowto.pdf\">http://www.akkadia.org/drepper/dsohowto.pdf

Ulrich Drepper's How to write shared libraries: http://www.akkadia.org/drepper/dsohowto.pdf

乌尔里希Drepper在库的设计,实施和维护良好做法:<一href=\"http://www.akkadia.org/drepper/goodpractice.pdf\">http://www.akkadia.org/drepper/goodpractice.pdf

Ulrich Drepper's Good Practices in library design, implementation, and maintenance: http://www.akkadia.org/drepper/goodpractice.pdf

dsohowto是更详细。 goodpractice是一个快速阅读。

dsohowto is much more detailed. goodpractice is a quick read.

这篇关于什么是关于对Linux共享库的良好做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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