Shared libraries are libraries that are loaded by programs when they start. A single shared copy of each library is loaded into physical memory and may be used by multiple processes at the same time. This reduces memory use and improves system performance. This tag should never be used alone.
Questions tagged [shared-libraries]
7905 questions
32
votes
5 answers
dyld: Library not loaded, Reason: image not found
I used gdb normally until this week. Now running gdb I see:
(gdb) r
Starting program: /Volumes/MyProg
dyld: Library not loaded: @rpath/libCore.so
Referenced from: /Volumes/MyProg
Reason: image not found
(gdb)
How to fix it?
I have:
OSX 10.9…

klm123
- 12,105
- 14
- 57
- 95
32
votes
3 answers
Linux equivalent of DllMain
In *nix .so libraries, is there an entry point that's invoked by the system when the library is loaded and unloaded?
On a more practical note: if the .so was written in C++ and it contains global objects with constructors and destructors, and it's…

Seva Alekseyev
- 59,826
- 25
- 160
- 281
31
votes
5 answers
Why shared libraries between microservices are bad?
Sam Newman states in his book Building Microservices
The evils of too much coupling between services are far worse than the problems caused by code duplication
I just don't understand how the shared code between the services is evil. Does the…

Tuomas Toivonen
- 21,690
- 47
- 129
- 225
31
votes
4 answers
"ld: unknown option: -soname" on OS X
I try to build my app with CMake on Mac OS X, I get the following error:
Linking CXX shared library libsml.so
ld: unknown option: -soname
collect2: ld returned 1 exit status
make[2]: *** [libsml.so] Error 1
make[1]: *** [CMakeFiles/sml.dir/all]…

Alex Ivasyuv
- 8,585
- 17
- 72
- 90
31
votes
1 answer
classes and static variables in shared libraries
I am trying to write something in c++ with an architecture like:
App --> Core (.so) <-- Plugins (.so's)
for linux, mac and windows. The Core is implicitly linked to App and Plugins are explicitly linked with dlopen/LoadLibrary to App. The problem I…

abel
- 519
- 1
- 5
- 15
30
votes
1 answer
gcc debug symbols (-g flag) vs linker's -rdynamic option
glibc provides backtrace() and backtrace_symbols() to get the stack trace of a running program. But for this to work the program has to be built with linker's -rdynamic flag.
What is the difference between -g flag passed to gcc vs linker's -rdynamic…

Manohar
- 3,865
- 11
- 41
- 56
30
votes
1 answer
Dependency Walker equivalent for Linux?
I need a tool to show all the shared library dependencies in some graphical way, not just with ldd on each .so. For MS Windows Dependency Walker works. Is there anything for Linux?
.

Rella
- 65,003
- 109
- 363
- 636
30
votes
4 answers
How do I create a dynamic library (dylib) with Xcode?
I'm building few command-line utilities in Xcode (plain C, no Cocoa). I want all of them to use my customized version of libpng, and I want to save space by sharing one copy of the library among all executables (I don't mind re-distributing .dylib…

Kornel
- 97,764
- 37
- 219
- 309
29
votes
3 answers
C++ cross-platform dynamic libraries for Linux and Windows
I am wanting to write some cross-platform library code.
I am creating a library both static and dynamic with most of the development done in Linux, I have got the static and shared library generated in Linux but now wanted to generate a Windows…

iQ.
- 3,811
- 6
- 38
- 57
28
votes
1 answer
How to create a shared library (.so) in an automake script?
Given some source file test.cpp I would like to create a shared library libtest.so . I am trying to do this within the scope of an automake file however I cannot seem to get this to work.
For example under g++ I do the following:
g++ -shared -fPIC…

skimon
- 1,149
- 2
- 13
- 26
28
votes
4 answers
Load shared library by path at runtime
I am building a Java application that uses a shared library written in C++ and compiled for different operating systems. The problem is, that this shared library itself depends on an additional library it normally finds under the appropriate…

aRestless
- 1,825
- 2
- 18
- 27
28
votes
5 answers
Include assets when building library using ng-packagr
Could anyone give a hint where to start to include images and css files into Angular library using ng-packagr?

Algis
- 612
- 1
- 8
- 23
28
votes
7 answers
C wrapper for C++ class with stack allocation
Let's say we have a C++ library with a class like this:
class TheClass {
public:
TheClass() { ... }
void magic() { ... }
private:
int x;
}
Typical usage of this class would include stack allocation:
TheClass object;
object.magic();
We need…

Pavel Strakhov
- 39,123
- 5
- 88
- 127
28
votes
3 answers
If clang++ and g++ are ABI incompatible, what is used for shared libraries in binary?
clang++ and g++ are ABI incompatible, even for things as core as standard containers, according to, e.g., the clang++ website.
Debian ships with C++ shared libraries, i.e. libboost, etc... that are compiled with ~something and user programs using…

Andrew Wagner
- 22,677
- 21
- 86
- 100
28
votes
3 answers
what is the difference between .so and .a files?
I am trying to compile a 3rd party library( on linux) and see that it is generating libsomething.a files I have my other libraries which are .so file
But it appears that even .a is shared library and can be used just like a .so lib
So is there any…

rajshenoy
- 501
- 1
- 7
- 16