c - Minor version checks for ELF shared libraries -


short version: how can emulate mach-o's compatibility version feature elf shared libraries?

long version: want create elf shared libraries "major.minor.patchlevel" versions. shared library should loaded executables linked against

  • the same major version and
  • a lower or equal minor version.

otherwise dynamic linker should throw error without running executable.

i know use linker version scripts seems tedious , error-prone specify versions every symbol in library. 1 idea had use version script single symbol every user of library must use, example initialization function. if function called lib_init, i'd write version script following version 1.2.x of library:

vers_1.0 { };  vers_1.1 { } vers_1.0;  vers_1.2 {     global: lib_init; } vers_1.1; 

would have desired effect?

another idea put explicit version check in lib_init, like:

void lib_init(int minor_version) {     if (minor_version > 2) abort(); } 

or there better solution?


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -