POSIX function to dynamically load a library or binary into memory
Questions tagged [dlopen]
685 questions
0
votes
1 answer
dlopen fails to undefined symbol for function that is a prototype
I am writing a shared library on Linux (64-bit) with C11.
I created 3 C and H files.
dll.c
#include "dllman.h"
void start(){
pipeListeningThreadFunc( NULL );
}
dllman.h
#include
void* pipeListeningThreadFunc( void* args…

tcak
- 2,142
- 1
- 16
- 23
0
votes
1 answer
using #defined function names as an input to dlsym
I have to use dlsym to load a function name from an external library.
But my concern is that he function is defined via a macro #define.
Assuming that dlopen call was successful, will dlsym find the correct symbol using the #defined name in this…

Jay Chung
- 175
- 1
- 1
- 11
0
votes
1 answer
Prevent dlsym() from importing the legacy Sleep() function on Mac OS X
Although neither documented anywhere nor included in the header files, Mac OS X APIs contain a function named "Sleep" (note the capital letter 'S') that puts the entire computer to sleep. See…

Andreas
- 9,245
- 9
- 49
- 97
0
votes
2 answers
OS X dlopen can't find framework - Image Not Found
I'm trying to add Google Breakpad (some external framework) support to my application. I have done all the required steps, but when I try to load my application using dlopen, I get this error:
(char *) error = 0x0000000100200175…

Tsury
- 729
- 1
- 9
- 24
0
votes
0 answers
stopping a process on dlopen failure
Perhaps a border-line question, more related to debugging & sysadmin that stricto sensu to coding
I'm working (on Debian/Sid/x86-64) on preparing the next GCC MELT release, it is a complex meta-plugin for GCC providing (thru a free software GPLv3…

Basile Starynkevitch
- 223,805
- 18
- 296
- 547
0
votes
0 answers
C Linux - How to load code from URL
Is there any way to load code/libary directly into RAM from the network in c on linux. It is possible in java using URLClassLoader but is there any way to implement the same functionality in c. So far i have found dlopen function in c to load so…

Somil
- 481
- 3
- 8
0
votes
0 answers
Binary runs in terminal but not in xcode simulator. When using the source code I get the same error
I'm using system() to call an executable binary that runs perfectly fine in the terminal, but does not work in the iOS simulator. I get a runtime error.
The error that I'm getting is:
dyld: unloaded: /software/evpath-4.dev/lib/libcmselect.so
…

Avi Frankl
- 211
- 4
- 6
0
votes
1 answer
How to resolve extern variable from dlopen'd library
Is it possible have a global variable defined inside an application, accessed by a shared library that has been loaded with dlopen()?
I have it declared as an extern but when the app loads and tries to use it I get an undefined symbol error.
I am…

hookenz
- 36,432
- 45
- 177
- 286
0
votes
1 answer
Local variable in function overlaps and clobbers memory space of static global variable defined in shared object
In my C project, I have a shared library compiled with -fPIC that contains several static data structures declared at global scope, including, let's say,
static struct mydata;
This library calls a function
void myfunc() {
char foo[2048] =…

Chris
- 474
- 2
- 8
- 22
0
votes
1 answer
gdb how to set breakpoint in dynamic library opened by dlopen
Afternoon,everbody.
I have an application 'test' compiled by main.c . A dynamic liabrary 'libtest.so' which is compiled by test.cpp with '-g'. In main.c I invoke the 'libtest.so' with 'dlopen' . And now I want to set a breakpoint in test.cpp ,but…

Wayne.liu
- 141
- 2
- 9
0
votes
1 answer
I can not get an execute-on-load function to work in a library using Qt
I have several libraries, each of which implement a class (derived from QObject). I would like each of these libraries to execute a function the first time they load. I found a couple of similar questions here:
Automatically executed functions when…

zarprime
- 3
- 4
0
votes
1 answer
how to deallocate memory allocated by dlopen()?
I am about to fix this issue. I read several queries regarding dlopen but still not clear. It seems dlopen is allocating memory by either calloc or malloc. But how to deallocate this memory?
Similar code pointing leak problem here for…

user2898325
- 31
- 4
0
votes
1 answer
dlopen with absolute path doesn't work
I execute dlopen method in a Monomac application:
MonoMac.ObjCRuntime.Dlfcn.dlopen("/.../SomeFramework.framework/SomeFramework", 0);
The first parameter is an absolute path to some external framework. This method always returns null pointer. How to…

alexey
- 8,360
- 14
- 70
- 102
0
votes
3 answers
C - Shared Library - dlopen, dlsym
for a research topic, I am using a C++ program to translate a SQL query into a C++ program. After translation, the c++ query source-code is compiled into a shared library:
g++ -O0 -g3 -fPIC -std=c++0x GeneratedQuery.cpp ../type/Types.cpp -shared -o…

moo
- 486
- 8
- 22
0
votes
1 answer
undefined reference to 'dlopen' in installing phonetisaurus
I was trying to install phonetisaurus. In the classical steps of configure, make, make install. I was stuck on make, where it produced this error. I have googled a lot, and many suggested appending -ldl at the back, but as you can see below, it's…

Daniel
- 1,484
- 5
- 24
- 42