Questions tagged [shared-libraries]

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.

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.
dthree
  • 19,847
  • 14
  • 77
  • 106
44
votes
4 answers

How to map function address to function in *.so files

backtrace function give set of backtrace how to map it with function name/file name/line number? for ex:- backtrace() returned 8 addresses ./libtst.so(myfunc5+0x2b) [0xb7767767] ./libtst.so(fun4+0x4a) [0xb7767831] ./libtst.so(fun3+0x48)…
Thangaraj
  • 3,038
  • 7
  • 40
  • 43
44
votes
3 answers

Purging and rebuilding ldconfig cache?

I am trying to purge the ldconfig cache of links to libraries to link against. I have a local folder where newly built libraries are placed. I want to update the ldconfig cache to point to these newly built libs. I have tried using the ldconfig -c…
eminemence
  • 721
  • 1
  • 6
  • 21
44
votes
4 answers

Shared library in Go?

Is it possible to create a Shared Library (.so) using Go? UPDATED: created an "issue" for it.
jldupont
  • 93,734
  • 56
  • 203
  • 318
43
votes
2 answers

Creating Haskell shared libraries on OS X

I'm trying to create a shared library from Haskell source code. I've tried following the instruction here: http://weblog.haskell.cz/pivnik/building-a-shared-library-in-haskell/ but I'm just not having any luck. When I compile with Haskell 64-bit…
benno
  • 2,077
  • 1
  • 19
  • 23