dynamic-linking

How to rename a shared library to avoid same-name conflict?

ⅰ亾dé卋堺 提交于 2020-12-03 11:54:55
问题 I found a library, libjson, that I am trying to build as a shared library and use in a project. Building is simple enough; after fixing a Makefile bug, # SHARED=1 make install will compile and install a .so in /usr/lib . The problem is that my system (Arch Linux) already has a library named libjson , which the Makefile thoughtlessly overwrites for me! Arch's library was installed as a dependency, so it can't be replaced. Presumably other distros would have a similar problem if they had a

How to rename a shared library to avoid same-name conflict?

微笑、不失礼 提交于 2020-12-03 11:51:05
问题 I found a library, libjson, that I am trying to build as a shared library and use in a project. Building is simple enough; after fixing a Makefile bug, # SHARED=1 make install will compile and install a .so in /usr/lib . The problem is that my system (Arch Linux) already has a library named libjson , which the Makefile thoughtlessly overwrites for me! Arch's library was installed as a dependency, so it can't be replaced. Presumably other distros would have a similar problem if they had a

Is it possible to override main method using LD_PRELOAD?

倾然丶 夕夏残阳落幕 提交于 2020-08-01 09:02:46
问题 This is mostly out of curiosity. I understand that definitions for library functions can be replaced (?) if I LD_PRELOAD my own library with my own definition for the library function. Can I do the same for the main method of an executable? That is, without rebuilding the executable, can I do something to the runtime so that a different main() is called? 回答1: No, you cannot use LD_PRELOAD to override the main function of a binary. LD_PRELOAD A whitespace-separated list of additional, user