Dynamic loading of shared objects using dlopen()

后端 未结 2 1587
Happy的楠姐
Happy的楠姐 2021-01-06 03:22

I\'m working on a plain X11 app.

By default, my app only requires libX11.so and the standard gcc C and math libs. The App can extend features with Xfixes, Xrender an

2条回答
  •  星月不相逢
    2021-01-06 03:48

    You should dlopen using the library's SONAME. You can see that by using readelf -d [libname].

    For example, on one of my Fedora Linux machines the SONAME of the C library is libc.so.6.

    The symlinks from the .so names to the .so.6 names are not guaranteed. Those symlinks are only needed for compiling software and are usually not installed on systems without the development packages.

    You would not want to end up loading a version with a different number anyway, because the number changes indicate major API differences.

提交回复
热议问题