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
49
votes
2 answers
Merge multiple .so shared libraries
Say I have a.so and b.so.
Can I produce c.so as a single shared library with all the functions exported by a and b, of course resolving all intra-dependencies (i.e. all functions of b.so called by a.so and the other way around)?
I tried
gcc -shared…

Metiu
- 1,677
- 2
- 16
- 24
49
votes
4 answers
Elegantly call C++ from C
We develop some project in plain C (C99). But, we have one library as source codes (math library) in C++. We need this library so I would like to ask, what is the most elegant way to integrate this source codes?
Ratio between sizes of C and C++ is…

Cartesius00
- 23,584
- 43
- 124
- 195
48
votes
2 answers
Linking a shared library using gcc
I have a shared library (*.so) created using Real View Compiler Tools (RVCT 3.2) on windows target. Then I try to link this *.so file with my application using gcc on linux system.
What is the gcc option to link this shared library with my…

goldenmean
- 18,376
- 54
- 154
- 211
48
votes
7 answers
Why do I have to define LD_LIBRARY_PATH with an export every time I run my application?
I have some code that uses some shared libraries (c code on gcc). When compiling I have to explicitly define the include and library directories using -I and -L, since they aren't in the standard places. When I try to run the code, I get the…

Paul Wicks
- 62,960
- 55
- 119
- 146
48
votes
2 answers
What does exactly the warning mean about hidden symbol being referenced by DSO?
I have a problem linking some shared library with g++. It gives me a warning like:
hidden symbol XXX in YYY is referenced by DSO /usr/lib/...
I've read some related questions about particular problems, but I want to understand it in a whole - what…

abyss.7
- 13,882
- 11
- 56
- 100
47
votes
1 answer
How to set the runtime path (-rpath) of an executable with gcc under Mac OSX?
I want to set under Mac OSX the runtime path of an executable (for the linker) at compile time, such that shared libraries at non-standard locations are found by the dynamic linker at program start.
Under Linux this is possible with -Xlinker -rpath…

maxschlepzig
- 35,645
- 14
- 145
- 182
46
votes
3 answers
How to use a DLL in a Haskell project?
I would like to use an external library, RDFox, in a Haskell project.
Context: I am working on Windows and Linux, both 64 bits, using GHC 7.10 and stack. RDFox is programmed in C++. RDFox shared libraries (.dll, .so) can be downloaded with Java and…

Der Vogel
- 460
- 3
- 6
46
votes
4 answers
Why does ld need -rpath-link when linking an executable against a so that needs another so?
I'm just curious here. I have created a shared object:
gcc -o liba.so -fPIC -shared liba.c
And one more shared object, that links against the former one:
gcc -o libb.so -fPIC -shared libb.c liba.so
Now, when creating an executable that links…

Troels Folke
- 917
- 2
- 9
- 12
45
votes
3 answers
use RPATH but not RUNPATH?
This page says about order for library search in ld.so:
Unless loading object has RUNPATH:
RPATH of the loading object,
then the RPATH of its loader (unless it has a RUNPATH), ...,
until the end of the chain, which is either the…

zaharpopov
- 16,882
- 23
- 75
- 93
45
votes
3 answers
Difference between modules and shared libraries?
The title mostly covers it, what is the difference between a module and a shared library? I just found this distinction in CMake's add_library command, where they say:
SHARED libraries are linked dynamically and loaded at runtime. MODULE libraries…

lucas clemente
- 6,255
- 8
- 41
- 61
45
votes
3 answers
JS - Can't combine lib files
I have multiple lib files in an an index.html file, that are loaded in proper sequence for an app I am running.