Dynamic linking is a system which allows libraries to remain separate from programs until loaded, contrast static linking.
Questions tagged [dynamic-linking]
1607 questions
28
votes
1 answer
What is the difference between .got and .got.plt section?
What is the difference between .got and .got.plt section in ELF format?

scdmb
- 15,091
- 21
- 85
- 128
27
votes
2 answers
How to set RPATH and RUNPATH with GCC/LD?
I recently encountered this problem after an upgrade of the system: using the GCC -Wl,-rpath= option works differently than before.
I used it to set the search paths to some shared libraries that were built in a sub-module of my project. At the time…

Machta
- 1,656
- 2
- 16
- 28
27
votes
2 answers
MySQL Improperly Configured Reason: unsafe use of relative path
I'm using Django, and when I run python manage.py runserver I receive the following error:
ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
…

nonamorando
- 1,556
- 2
- 14
- 33
26
votes
5 answers
Understanding how dynamic linking works on UNIX
Consider we have the following situation:
a program named program which depends dynamically on libfoo.so
libfoo.so that depends on nothing (well, it depends on libstdc++ and stuff but I guess we can omit that)
program runs perfectly.
Suddenly,…

ereOn
- 53,676
- 39
- 161
- 238
25
votes
3 answers
Why is fPIC absolutely necessary on 64 and not on 32bit platforms?
I recently received a:
...relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
error while trying to compile a program as a shared library.
Now the solution to this is not too difficult…

Bojan B
- 393
- 3
- 9
25
votes
5 answers
g++: In what order should static and dynamic libraries be linked?
Let's say we got a main executable called "my_app" and it uses several other libraries: 3 libraries are linked statically, and other 3 are linked dynamically.
In which order should they be linked against "my_app"?
But in which order should these be…

Michael
- 889
- 2
- 9
- 7
25
votes
3 answers
Linking Rust application with a dynamic library not in the runtime linker search path
I have a shared library that I'd like to dynamically link into several separate binary Cargo applications. I include its location in the linker using the -- -L /path/to/dir format and the application compiles correctly with the significant decrease…

Ameo
- 2,307
- 5
- 21
- 33
23
votes
1 answer
Is the function 'dlopen()' private API?
I want use function 'dlopen()' to invoke a dynamic library on iOS platform, is the function 'dlopen()' private API?

Donald
- 321
- 1
- 2
- 10
23
votes
8 answers
Simulate static abstract and dynamic linking on static method call in Java
Introduction
As a disclaimer, I'v read Why can't static methods be abstract in Java and, even if I respectfully disagree with the accepted answer about a "logical contradiction", I don't want any answer about the usefulness of static abstract just…

krtek
- 26,334
- 5
- 56
- 84
23
votes
5 answers
Building and linking dynamically from a go binary
My problem is the following:
I have a go binary on a machine
From that binary I need to compile an external .go file
Once compiled, I need to link the compiled go file into the current binary so I can use the just-compiled go code.
Do you think…

Jérôme R
- 1,227
- 2
- 13
- 23
22
votes
4 answers
c++ linux double destruction of static variable. linking symbols overlap
Environment: linux x64, compiler gcc 4.x
Project has following structure:
static library "slib"
-- inside this library, there is static object "sobj"
dynamic library "dlib"
-- links statically "slib"
executable "exe":
-- links "slib" statically
--…

John
- 749
- 8
- 17
21
votes
3 answers
Is there such a thing as a generic function pointer in C that can be assigned/cast to a more restrictive prototype?
I have the need to dynamically link against a library at run-time and resolve a series of functions using dlsym. My first thought was to use an array of function pointers that can be easily iterated through by leveraging a secondary array of char *…

sherrellbc
- 4,650
- 9
- 48
- 77
21
votes
1 answer
Calling Haskell from Java, dynamic linking error Relocation
I'm having troubles with compiling a standalone library for use by Java (with C++ inbetween).
There is a program in Haskell exporting one function that processes some text and returns it.
The program in Haskell needs some external data (binary…

niczka
- 351
- 1
- 12
21
votes
1 answer
Dynamic loading and weak symbol resolution
Analyzing this question I found out some things about behavior of weak symbol resolution in the context of dynamic loading (dlopen) on Linux. Now I'm looking for the specifications governing this.
Let's take an example. Suppose there is a program a…

MvG
- 57,380
- 22
- 148
- 276
21
votes
3 answers
C++ Visual Studio: linking using pragma comment
I came across a piece of code which uses #pragma comment(lib, "libraryname").
Why this type of usage as opposed to just linking the library from the properties menu? In what situations is this usage called for? I am in windows using C++…

user1612986
- 1,373
- 3
- 22
- 38