Questions tagged [dlclose]

6 questions
1
vote
0 answers

My executable has references to dlcose - but wherefor?

I'm trying to link some executable, built from C++ source files, and getting: /usr/bin/ld: examples/CMakeFiles/whatever/main.cpp.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5' Now, I know how to "fix" this: How to fix undefined reference…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
1 answer

Multiple load (dlopen) and unload (dlclose) of the same shared object calls resulting in segmentation fault

In my code, I have a for loop where first I am calling dlopen to load a shared object, then calling a function of the loaded library, and then dlclose to unload it. The first iteration of the loop works as expected but during the second iteration…
Aayush
  • 33
  • 4
0
votes
0 answers

How to dlclose and unmap DSO even when tls_dtors exist, or reinitialize DSO when calling dlopen at second round

I want to get fresh DSO (which means it's global variable is set to init status) whenever I call dlopen. But when DSO contains tls dtor, dlclose will not unload/unmap this DSO, and at next time I dlopen it, it gives me old handler and old DSO…
0
votes
0 answers

Segmentation fault when closing a dynamic library with dlclose() where OpenMP directives are in use

I have these two files - "shared.c" and "test1.c" /* shared.c */ #include "stdio.h" #include "string.h" #include "omp.h" int ompfunc1(void){ int count = 0; #pragma omp parallel num_threads(4) { #pragma omp atomic count++; } …
0
votes
1 answer

Is there a way I can add a shared object file (.so) to ld.so.cache?

I wrote a simple C program that does a dlopen on an shared object: handle = dlopen ("./MySharedObject.so", RTLD_LAZY); if (!handle) { fputs (dlerror(), stderr); exit(1); } sleep(20) dlclose(..) Now I compile…
DZone
  • 3
  • 1
-2
votes
2 answers

Passing null to dlclose()

Is it safe to pass null (0, NULL, nullptr, ..) to dlclose()? I could not find anything regarding this in the manual.
Joel Bodenmann
  • 2,152
  • 2
  • 17
  • 44