dlsym Questions

7

Solved

I am trying to use dlopen() and dlsym() in my code and compile it with gcc. Here is the first file. /* main.c */ #include <dlfcn.h> int main() { void *handle = dlopen("./foo.so", RTLD_NO...
Activism asked 3/4, 2016 at 10:18

5

Solved

I have c++filt command to demangle a symbol, what is the tool to do the opposite and mangle a symbol name? This would be useful if I were to want to call dlsym() on a mangled C++ function name. I'...
Intolerable asked 4/7, 2012 at 21:28

0

I want to simulate loading symbols from a shared library for testing purposes. Is there a way to define a symbol at runtime programmatically such that dlsym will find it? For example: dl_define_sy...
Choragus asked 18/4, 2022 at 11:2

2

Solved

I'm faced a strange runtime behavior on Ubuntu 20.04 (gcc v 9.3.0) when using dlsym() call. Please, see below a simple example: file test.cpp: #include <iostream> #include <dlfcn.h> #...
Amato asked 25/6, 2021 at 9:20

2

Solved

My title may not be clear, so allow me to explain. I have a piece of code that goes like this: void* pluginFile = dlopen(fileName, RTLD_LAZY); auto function = dlsym(pluginFile, "ExpectedFunction"...
Headman asked 11/7, 2019 at 16:24

2

Solved

I am using dlsym to look up symbols in my program, but it always returns NULL, which I am not expecting. According to the manpage, dlsym may return NULL if there was an error somehow, or if the sym...
Retiform asked 8/5, 2016 at 21:19

4

Solved

In Linux. Per the dlsym(3) Linux man page, *Since the value of the symbol could actually be NULL (so that a NULL return from dlsym() need not indicate an error),* Why is this, when can a symbo...
Average asked 18/12, 2012 at 21:40

3

Solved

I have to perform dynamic linking on a variadic function of following format: int foo(char *args, const char *f, ...) Here the number of arguments are variable. What I want to achieve is that I...
Cocainize asked 1/8, 2018 at 6:8

5

Solved

I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the LD_LIBRARY_PATH , if not found...
Begum asked 1/7, 2009 at 5:5

1

Solved

it's very easy to find how to use dlsym() and other functions from this family, but how does it work internally? Is it possible to write own, easy implementation of dlsym()? I'm wondering if it is...
Catt asked 4/7, 2016 at 20:24

3

Solved

dlopen() is a C function used for dynamically loading shared libraries at runtime. The pattern, in case you're not familiar, is thus: Call dlopen("libpath", flag) to get a void *handle to the lib...
Shannashannah asked 16/3, 2016 at 15:57

2

Solved

I'm using dlsym() in C and I have a question whether the return value of dlsym() should be explicitly cast or if it is implicitly cast correctly. Here is the function: double (*(compile)(void))(do...
Hassock asked 20/7, 2015 at 21:44

1

Background The POSIX standard adds a lot of library functions and other identifiers to the C language. In the description of the dlsym() function, it says (with my emphasis): SYNOPSIS #include...
Eddra asked 30/12, 2014 at 14:16

1

In my C shared library, I want to dlopen() another shared library and retrieve a list of the exported symbols this library has. Is there a way I can do that programmatically, without running nm/ob...
Pickup asked 16/11, 2014 at 18:17

5

Solved

I'm in the process of writing a kind of runtime system/interpreter, and one of things that I need to be able to do is call c/c++ functions located in external libraries. On linux I'm using the dlf...
Biddle asked 7/7, 2010 at 11:58

5

Solved

In my C++ program, how can I detect programmatically at runtime whether symbols have been stripped via the 'strip' gnu development tool on Linux? I'd like a function definition which returns true ...
Immoderate asked 28/2, 2011 at 16:22

2

I want to intercept application's calls to dlsym. I have tried declaring inside the .so that I am preloading dlsym , and using dlsym itself to get it's real address, but that for quite obvious reas...
Jumble asked 24/3, 2013 at 13:26

1

Solved

Good evening, I'm currently working on a Plugin system in C++/Linux based on the Plux.net model. To keep it simple, I basicly declare a symbol (lets call it pluginInformation) with extern C (to un...
Alumnus asked 14/9, 2013 at 2:43

1

Solved

Is there any hope of running dlopen(NULL, ...) and getting symbols for a statically compiled binary? For example, with the following code I can get symbols if the program is compiled dynamically a...
Moil asked 12/1, 2013 at 2:12

2

Solved

I get the following error when I try to run a script I have only execution access for: uname: symbol lookup error: /home/dumindara/random/sotest/a.out: undefined symbol: dlsym This is after I hav...
Genocide asked 8/12, 2010 at 7:33

1

Solved

I am trying to interpose calls to pthread_cond_broadcast using LD_PRELOAD mechanism. My interposed pthread_cond_broadcast function just calls the original pthread_cond_broadcast. However, for a ver...
Theft asked 9/9, 2012 at 19:16

2

Can't I call a function by name in iOS? I have a C function called getstring. I am calling it as follows: void* handle = dlopen(NULL, RTLD_NOW); if (handle) { fp func = dlsym(handle, "getstring");...
Collogue asked 18/2, 2011 at 10:56

4

Solved

I'm currently working on a project where I need to track the usage of several system calls and low-level functions like mmap, brk, sbrk. So far, I've been doing this using function interposition: I...
Coed asked 15/6, 2009 at 21:22

4

Solved

Intro Let me apologise upfront for the long question. It is as short as I could make it, which is, unfortunately, not very short. Setup I have defined two interfaces, A and B: class A // An int...
Antependium asked 28/2, 2010 at 17:5

1

Solved

Background: I've found myself with the unenviable task of porting a C++ GNU/Linux application over to Windows. One of the things this application does is search for shared libraries on specific pa...
Nostradamus asked 23/2, 2011 at 21:20

© 2022 - 2024 — McMap. All rights reserved.