POSIX function to dynamically load a library or binary into memory

43
votes
3answers
3k views

building a .so that is also an executable

So everyone probably knows that glibc's /lib/libc.so.6 can be executed in the shell like a normal executable in which cases it prints its version information and exits. This is done via defining an ...
30
votes
4answers
29k views

Automatically executed functions when loading shared libraries

When loading shared libraries in Windows, LoadLibrary() call causes DllMain in library to execute for each new process and thread library attaches to, and for each process and thread library ...
25
votes
4answers
6k views

dlopen from memory?

I'm looking for a way to load generated object code directly from memory.I understand that if I write it to a file, I can call dlopen to dynamically load its symbols and link them. However, this ...
8
votes
2answers
4k views

how to call function in executable from my library?

I have an executable and a dynamic library (.so). The library exports some symbols and executable calls it successfully. But I want to make possible to library call executable's functions. I've tried ...
72
votes
10answers
60k views

MatLab error: cannot open with static TLS

Since a couple of days, I constantly receive the same error while using MATLAB which happens at some point with dlopen. I am pretty new to MATLAB, and that is why I don't know what to do. Google doesn'...
4
votes
1answer
8k views

Error: dlopen() Library not loaded Reason: image not found

I am a newbie in this field. My laptop is Macbook air, Software: OS X 10.8.5 (12F45). I am running a code which gives me the following error:dlopen(/Users/ramesh/offline/build_icerec/lib/icecube/...
10
votes
1answer
12k views

library path when dynamically loaded?

How can I get the path of the shared library from within the library itself?In other words, let's say that library X is loaded using dlopen(), how can I get access to the path that was used to load ...
13
votes
4answers
6k views

dynamic_cast fails when used with dlopen/dlsym

IntroLet me apologise upfront for the long question. It is as short as I could make it, which is, unfortunately, not very short.SetupI have defined two interfaces, A and B:class A // An ...
8
votes
2answers
442 views

Creating a static C struct containing strings

I'm trying to create a dynamic library in Rust that exports a struct as a symbol that will be loaded into a C program via dlopen().However, I'm was running into some segfaults when accessing the ...
2
votes
2answers
189 views

Is there an elegant way to avoid dlsym when using dlopen in C?

I need to dynamically open a shared library lib.so if a specific condition is met at runtime. The library contains ~700 functions and I need to load all their symbols.A simple solution is to define ...
18
votes
3answers
20k views

Receive “undefined symbol” error when loading library with dlopen

I'm writing some code that uses dynamic shared libraries as plugins.My command line for building the shared libraries looks like:cc -shared -fPIC -o module.so -g -Wall module.cWithin the module, ...
8
votes
1answer
5k views

Main Program and Shared Library initializes same static variable in __static_initialization_and_destruction_0

Does anyone know why a library initialized within dlopen() would initialize a static variable owned by the main program. Both the main program and shared library have a copy of the static variable, ...
12
votes
3answers
4k views

linux dlopen: can a library be “notified” when it is loaded?

Is there a way for a shared library to be "notified" when it is loaded? In other words, let's say I use dlopen on a shared library, is there a function that is automatically called (if present) on ...
11
votes
4answers
4k views

Using dlopen() on an executable

I need to call a function from another program. If the other program were a library, I could simply use dlopen and dlsym to get a handle to the function. Unfortunately, the other program is a Unix ...
9
votes
1answer
6k views

C++: dlclose doesn't unload the shared library

I have a shared library loaded using dlopen (with the flags RTLD_NOW | RTLD_GLOBAL ).If this library is using functions from the main program, then it does not unload. So I end up with the same code ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,