POSIX function for accessing code or data in a dynamically-loaded library using the code's name.
Questions tagged [dlsym]
187 questions
0
votes
1 answer
How to dynamically load a Rust library in C?
I'm trying to dynamically link a Rust .so library with a C program in Linux with gcc. Using only dlopen and dlclose results in no errors, but I get a segmentation fault with the following code:
char * (*my_function)(char *);
char *my_input_string =…

Alex Lamson
- 479
- 5
- 14
0
votes
1 answer
Working with shared libraries - is it still just dlopen, dlsym et al?
I've used dlopen(), dlsym() and friends in the past to load dynamic libraries manually at run-time - but that was in C. In C++ I would expect a somewhat higher-level-of-abstraction API, or at least - something which transparently takes care of name…

einpoklum
- 118,144
- 57
- 340
- 684
0
votes
2 answers
C plugin system
I am writing a plugin system for a shell in C using dlopen and dlsym with shared objetcs.
I wonder if a function in a shared object use a global in the same object, would the variable still be available for the function when loaded with dlopen,…

Nicolas Scotto Di Perto
- 967
- 1
- 8
- 23
0
votes
1 answer
iOS library not loaded when using IPA
My code uses an external library using dlsym (for reasons out of my control).
In order Xcode to find my library, I had to do 2 things:
-force_load "$(SRCROOT)/pathTo/myLibrary.a"
Dead-Code Stripping: NO
This works fine when running wit the debug…

Nathan H
- 48,033
- 60
- 165
- 247
0
votes
1 answer
dlsym ends in infinite loop
I am trying to build a Linux library(*.so) to use it in a Java application. This library itself loads an dll-file with native functions.
This is my C++ code:
__delspec(dllexport) void __cdecl GetDllVersion(void){
typedef…

wurmi
- 333
- 5
- 18
0
votes
1 answer
C - What library (.so file) is the c function open() in, and how would I find that out for an arbitrary function?
How can I find the library where the function open() is? Like, the name of the actual "xxxxxx.so" file that contains that function? Also, is there a place I could typically get this information for other functions?

user3475234
- 1,503
- 3
- 22
- 40
0
votes
1 answer
Error while dynamically linking LibCURL
I'm trying to dynamically link libcurl, but I'm getting Segfault when easy_performing.
Here are the global scope declaration:
#define LIBCURL_PATH_64 "/usr/lib64/libcurl.so"
void *hLibCurl = NULL;
CURL *curl;
CURL*…

rfermi
- 179
- 11
0
votes
1 answer
How to check enum values exists using dlsym?
dlsym returns null for enum values
NSLog(@"%s",dlsym(RTLD_DEFAULT, "NSTextAlignmentCenter"));
Output
2014-01-28 13:07:04.243 TestProject[763:60b] (null)

Inder Kumar Rathore
- 39,458
- 17
- 135
- 184
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
0 answers
Access static methods and fields with class type returned by dlsym
Can we access static methods and fields with class type returned by dlsym?
Ex:
MyClass* pMyClass= (MyClass*)dlsym(phandle, "MyClass");
pMyClass->staticFunction();
pMyClass->staticField=0;
;

Avinash
- 3
- 1
0
votes
1 answer
Android4.2 libdvm.so Can't find the function of dexFileParse
libdvm.so inside of Android2.3, i can use the code to call dexFileParse
code:
void * handle=dlopen("/system/lib/libdvm.so",RTDL_LAZY);
void *pFunc=dlsym(handle,"dexFileParse");
but libdvm.so exports _Z16dexFileParseXXX,i won't get the address of…

olggun
- 3
- 1
0
votes
1 answer
how to load function with dlsym from dlfcn.h with Cython
I'm puzzling how to load a shared object library function and use this with Cython. I've created a dlfnc.pxd file as below:
#dlfcn.pxd
cdef extern from *:
ctypedef char const_char "const char"
cdef extern from 'dlfcn.h' nogil:
void*…
0
votes
1 answer
Shared library and member functions
I'm facing a little problem in C++.
So, I have a game, a sort of Snake, and I want to do it with three different graphic libraries. (like libsdl.so, libndk.so and libQt.so).
I have the following classes :
DisplaySDL.hh :
#ifndef DISPLAYSDL_HH__
#…

Yanis Boucherit
- 694
- 3
- 8
- 16
0
votes
1 answer
dlsym() returns strange address of symbol
1). print function address directly:
printf("strerror=%p, strerror_r=%p\n", strerror, strerror_r);
strerror=0x8049ec0, strerror_r=0x8049e20
2). dlsym version:
rtldDefault= dlopen(0, RTLD_NOW | RTLD_GLOBAL);
dlsym(rtldDefault, "strerror_r"); ==>…

David Chyi
- 159
- 1
- 9
0
votes
3 answers
Problem in using C dynamic loading routines
I have an application consisting of different modules written in C++.
One of the modules is meant for handling distributed tasks on SunGrid Engine. It uses the DRMAA API for
submitting and monitoring grid jobs.If the client doesn't supports grid,…

sud03r
- 19,109
- 16
- 77
- 96