Skip to content

Commit

Permalink
test-dlopen: allow loading of multiple libraries
Browse files Browse the repository at this point in the history
This is useful for debugging, for example if we want to test multiple different
dlls being loaded in the same namespace.
  • Loading branch information
keszybz committed May 30, 2023
1 parent 6483bce commit 5ad6600
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/test-dlopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
#include "macro.h"

int main(int argc, char **argv) {
void *handle;
void *handles[argc - 1];
int i;

assert_se(handle = dlopen(argv[1], RTLD_NOW));
assert_se(dlclose(handle) == 0);
for (i = 0; i < argc - 1; i++)
assert_se(handles[i] = dlopen(argv[i + 1], RTLD_NOW));

for (i--; i >= 0; i--)
assert_se(dlclose(handles[i]) == 0);

return EXIT_SUCCESS;
}

0 comments on commit 5ad6600

Please sign in to comment.