How Do so (Shared Object) Filenames Work in Linux

Shared Objects (SO) are dynamic libraries in Linux that contain code and data shared between multiple processes. Similar to DLLs in Windows, SO files enable efficient memory usage and modular programming by allowing multiple programs to share the same library code loaded in memory.

What are Shared Objects?

Shared objects are files containing executable code and data that can be loaded and linked at runtime. When a program needs functionality from a shared library, the dynamic linker loads the SO file into memory and makes it available to the requesting process. Multiple programs can simultaneously use the same shared object without duplicating the code in memory.

This approach reduces executable file sizes, minimizes memory consumption, and enables code reusability across different applications.

Shared Object Naming Convention

Linux shared object filenames follow a standardized naming pattern that provides essential information about the library

lib<name>.so.<major>.<minor>.<patch>

Breaking down each component

  • lib Standard prefix indicating a shared library

  • <name> Descriptive library name (e.g., crypto, ssl, gtk)

  • .so File extension for shared object

  • <major> Major version number indicating API/ABI compatibility

  • <minor> Minor version for backward-compatible changes

  • <patch> Patch level for bug fixes (optional)

Examples

Here are common shared object files and their interpretations

Filename Library Major.Minor Purpose
libcrypto.so.1.1 crypto 1.1 OpenSSL cryptographic functions
libssl.so.1.1 ssl 1.1 SSL/TLS protocol implementation
libX11.so.6 X11 6.0 X Window System client library
libgtk-3.so.0 gtk-3 0.0 GTK+ 3 GUI toolkit

Library Search Process

The dynamic linker (ld.so) locates shared objects at runtime by searching in this order

Dynamic Linker Search Order 1. LD_LIBRARY_PATH 2. /etc/ld.so.cache 3. /lib, /lib64 4. /usr/lib, /usr/lib64 Error: Library not found

Common Search Locations

  • /lib, /lib64 Essential system libraries

  • /usr/lib, /usr/lib64 Standard user libraries

  • /usr/local/lib Locally installed libraries

  • LD_LIBRARY_PATH User-defined search directories

Version Compatibility

Major version changes indicate incompatible API/ABI modifications. Programs compiled against an older major version may not work with a newer major version.

Minor version changes maintain backward compatibility while adding new features. Applications can safely use newer minor versions of the same major version.

Symbolic Links for Version Management

libexample.so.2.1.0    # Actual library file
libexample.so.2.1 ?    # Minor version link
libexample.so.2 ?      # Major version link  
libexample.so ?        # Development link

Benefits of Shared Objects

Benefit Description
Memory Efficiency Single copy in memory shared by multiple processes
Disk Space Smaller executable files, reduced storage requirements
Runtime Linking Libraries loaded only when needed
Code Updates Library updates without recompiling programs

Managing Shared Objects

Use ldd command to view shared object dependencies

$ ldd /usr/bin/ls
    linux-vdso.so.1 =>  (0x00007fff1234567)
    libselinux.so.1 => /lib64/libselinux.so.1
    libc.so.6 => /lib64/libc.so.6
    libpcre.so.1 => /lib64/libpcre.so.1

Update the dynamic linker cache after installing new libraries

$ sudo ldconfig

Conclusion

Shared object filenames in Linux follow a structured naming convention that encodes library identity and version information. The dynamic linker uses this information to locate and load the appropriate library versions at runtime, enabling efficient memory usage and modular program design.

Updated on: 2026-03-17T09:01:38+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements