Can someone explain about Linux library naming?

前端 未结 5 545
小鲜肉
小鲜肉 2021-02-07 02:46

When I create a library on Linux, I use this method:

  1. Build: libhelloworld.so.1.0.0
  2. Link: libhelloworld.so.1.0.0 libhelloworld.so
  3. Link: libhellowo
5条回答
  •  囚心锁ツ
    2021-02-07 02:59

    The way you're supposed to form the x.y.z version is like this:

    1. The first number (x) is the interface version of the library. Whenever you change the public interface, this number goes up.
    2. The second number (y) is the revision number of the current interface. Whenever you make an internal change without changing the public interface, this number goes up.
    3. The third number (z) is not a build number, it is the backwards-compatability count. This tells you how many previous interfaces are supported. So for example if interface version 4 is strictly a superset of interfaces 3 and 2, but totally incompatible with 1, then z=2 (4-2 = 2, the lowest interface number supported)

    So the x and z numbers are very important for the system to determine if a given app can use a given library, given what the app was compiled against. The y number is mainly for tracking bug fixes.

提交回复
热议问题