POSIX function to dynamically load a library or binary into memory
Questions tagged [dlopen]
685 questions
7
votes
1 answer
dlopen malloc deadlock
We have some unit tests that often deadlock. Closer inspection with GDB reveals the following:
Thread 1:
(gdb) bt
#0 0x00110424 in __kernel_vsyscall ()
#1 0x00c681a3 in __lll_lock_wait_private () from /lib/libc.so.6
#2 0x00bf09fb in _L_lock_515…

Paul Praet
- 1,367
- 14
- 25
6
votes
2 answers
Ld magically overrides statically linked symbols
For a few days we are dealing with very strange problem.
I can't understand how it even happens - when a third-party (MATLAB) program uses our shared library, it somehow overrides some of our symbols (boost, to be precise) with it's own. Those…

ALOR
- 545
- 1
- 9
- 20
6
votes
1 answer
When to actually use dlopen()? Does dlopen() means dynamic loading?
I have gone through below link, through which I understood how to create and use shared library.
https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html
Step 1: Compiling with Position Independent Code
$ gcc -c -Wall -Werror -fpic…

dev
- 649
- 9
- 11
6
votes
1 answer
perl6 NativeCall doesn't find library on Darwin
I'm playing a bit with NativeCall to get familiar with that side of Perl6. Of course, I'm trying to load libstatgrab first (what else?).
So I start with easiest part - the host information. Since no cluster support yet, it's just one result - no…

Sno
- 179
- 1
- 7
6
votes
2 answers
Loading dll in windows C for cross-platform design
I wrote a c-code designed for linux platform.
Now, I want to make it cross-platform so to use in Windows as-well.
In my code, I dlopen an so file and utilize the functions inside it.
Below is how my code looks like. But I just found out that in…

윤제균
- 149
- 1
- 10
6
votes
1 answer
How to achieve symbol versioning
I want to achieve something like below :
I have multiple versions of a library. I dynamically load the latest version of the library using dlopen(). Then I want to see if a particular function (along with similar return type and argument list)…

Pein
- 1,421
- 2
- 11
- 9
6
votes
1 answer
Runtime library reloading using `dlopen`
Is it possible for a running c++ based process to reload a c++ based dynamic library using dlopen.
The running process polls for a new version of the dynamic library (with the same API). once such file is detected, the following set of actions are…

Zohar81
- 4,554
- 5
- 29
- 82
6
votes
3 answers
Duplicate static variable initialization in C++
I build a shared library "libMyLibrary.so" with a class "MyClass" that contains a static variable of type "MyClass".
Then I build an executable "MyLibraryTest" that I link against "libMyLibrary.so".
The main program uses "dlopen" to load dynamically…

ConanLord
- 73
- 5
6
votes
1 answer
libpthread.so continues to use TLS space and DL namespaces after `dlclose()`
I'm working on a project that needs to arbitrarily load/unload Rust-based plugins (shared objects) into isolated dynamic library namespaces.
I use dlmopen(LM_ID_NEWLM, "rust-plugin.so", RTLD_LAZY) to create a new namespace for a shared object. When…

twink_ml
- 512
- 3
- 14
6
votes
1 answer
_dl_close Assertion failure
I'm using dlopen() in an Apache module that I am writing so that I can have a plugin system for my module. I've found that if I compile my module, compile my plugin, and start Apache, everything works peachy-keen.
If, however, after I have done all…

dave mankoff
- 17,379
- 7
- 50
- 64
6
votes
1 answer
Race condition in android dlopen()?
My Android app has a simple "loader" NativeActivity with a very simple android_main() which only loads a different shared object and passes control to it:
typedef void (*Tandroid_main)( android_app*);
void android_main( android_app* state )
{
…

shoosh
- 76,898
- 55
- 205
- 325
6
votes
2 answers
How to diagnose failures in dlopen() on iOS devices
I've got a C library that is being used in an iOS app. This library uses dlopen() to access extension functionality. The code works fine on the iOS simulator (in both 32 bit and 64 bit modes); however, when I run the same code on an actual iPhone5s…

freakboy3742
- 1,026
- 10
- 15
6
votes
2 answers
Dynamic loading of shared objects using dlopen()
I'm working on a plain X11 app.
By default, my app only requires libX11.so and the standard gcc C and math libs.
The App can extend features with Xfixes, Xrender and ALSA sound system.
However, these (Xfixes, Xrender and ALSA) feature are…

Andy
- 63
- 1
- 3
6
votes
1 answer
Is there a load leak if dlopen() is called from a dlopen'd library?
If my executable calls dlopen to load a library but neglects to call dlclose, the library will stay loaded until the process exits and the OS forces it to unload.
If I load a.so which loads b.so, then call dlclose on a.so, does the OS unload b.so as…

Kietz
- 1,186
- 11
- 19
6
votes
1 answer
Undefined symbols on erlang nif shared library
I'm having troubles trying to link my shared library(an erlang nif), to another shared library(libpurple), that loads other shared libraries(plugins) using dlopen.
The issue is that mylib.so links to libpurple.so, libpurple.so loads plugins.so…

roger
- 141
- 1
- 5