Questions tagged [dlopen]

POSIX function to dynamically load a library or binary into memory

685 questions
0
votes
1 answer

How do I symbolicate from a list of libraries and addresses in them?

I'm trying to symbolicate a crash log on my device. I have the stack frames, the instruction pointer addresses for each frame, the module that the IP was in, and the offset into that module. My plan is to use dladdr() to get the function or method…
Greg
  • 10,360
  • 6
  • 44
  • 67
0
votes
3 answers

Error on dlopen: St9bad_alloc

I have some c++ code I'm using for testing in which the first line is a call to dlopen in an attempt to load my shared object. Upon hitting this line I get the following error: Terminate called after throwing an instance of std::bad_alloc: …
Ben L
  • 6,618
  • 8
  • 39
  • 34
0
votes
2 answers

Why am I not able to use my function that is declared in .so library?

I'm trying to write a program to call functions inside my .so library in Android. main.cpp: #include #include #include typedef int (*test_ptr)(int, int); int main() { int rc; void *handle; const char…
Tony
  • 187
  • 1
  • 3
  • 14
0
votes
1 answer

dlopen based application runs differently (erroneous) in the second time

I have an script interpreter that is spawn by a deamon and has to be up all the time. In other words, as soon as it goes down (crash, segfault, normal termination, whatever), the daemon spawns that again. This interpreter opens a library dynamically…
Marcus
  • 1,675
  • 3
  • 18
  • 29
0
votes
2 answers

Android, opening system library from native code

Good afternoon, I would really appreciate if anybody can, please, give a clue about what can be happening in the following scenario involving dlopen. I'm trying to load Android's system's library libmedia.so by calling…
jcm
  • 2,568
  • 14
  • 18
0
votes
0 answers

failed to map segment from shared object: Resource temporarily unavailable

On Linux x86_64 when loading a shared library i get dlopen error: "FILENAME" failed to map segment from shared object: Resource temporarily unavailable The machine has 48 GiB host memory installed, no other user logged in. So, its likely not to be…
ritter
  • 7,447
  • 7
  • 51
  • 84
0
votes
0 answers

How does the System.loadLibrary() loads the shared library in Android?

How does the System.loadLibrary("library-name") works in android.Does it invokes the hw_get_module() of dlopen() of libhardware.so or via linker-loaded method ? Rgds, Softy
Raulp
  • 7,758
  • 20
  • 93
  • 155
0
votes
1 answer

C++ run time type mismatch with Python module?

Unfortunately I can't post the source code for this, but I will try to set it up as best I can. I have a case where dynamic_cast fails to cast to a derived class type, and I know it should succeed (ie, I know the actual type of the instance). Also …
0
votes
1 answer

Shared Object Library and MPI

I am working on a project that uses MPI to create parallel processes, each process uses dlopen() to load a module that's been build as a shared object library. One of the modules that I'm writing uses a 3rd party library (HDF). When I run the…
JeffW
  • 176
  • 1
  • 14
-1
votes
1 answer

Why calling dlopen sometimes breaks my application by damaging class variables content?

I am trying to load library with dlopen(). But call to this dlopen() function sometimes (not always) damages my class variables and then app goes to segmentation fault. Below is not precise code (pseudocode), but explanation what happens: class…
nckm
  • 103
  • 1
  • 10
-1
votes
2 answers

Hook library function using custom method using dlsym

I am recently started looking in hooking into library from C++ code. There is a slight confusion with the symbol table creation. Below is my code (Picked from some online resource, I compiled C code with C++) hook_main.cpp #include…
unbesiegbar
  • 471
  • 2
  • 7
  • 19
-1
votes
1 answer

how to write a function pointer "pointing" to a macro which expands to the actual function?

I have function in library lib.so which I'm linking to my application dynamically using dlopen() lib.h void DebugPrint( unsigned char logLevel, const char *programName, const char *format, …
-1
votes
1 answer

Dealing with custom types in a library using dlopen

I need to load a library dynamically at runtime, and the code doesn't have the custom types the library uses defined at compile time. This seems to initialize the struct correctly: void *data = malloc(128); InitCustomType(data); The problem with…
Lurkki
  • 17
  • 2
-1
votes
1 answer

dlopen fails in a library instantiating an object

We have a minimal working example of dlopen that works. void* lib = dlopen("servlets.so", RTLD_NOW); void* p = dlsym(lib, "getServlets"); However, if we add another function to the shared library (not even if it is called) then the library does…
Dov
  • 8,000
  • 8
  • 46
  • 75
-1
votes
1 answer

Using dlopen/dlsym to open C++ shared library - dlsym returns NULL

I have not yet dealt with shared libraries in C++, and am having some trouble. I want to create a shared library and then have a C function pick up on that library. So here is my shared library file: extern int nothing(); //sym.cpp int nothing() { …
Sidd Singal
  • 559
  • 6
  • 16
1 2 3
45
46