Files
systemd/src/test/test-dlopen.c
T
Zbigniew Jędrzejewski-Szmek 5ad6600364 test-dlopen: allow loading of multiple libraries
This is useful for debugging, for example if we want to test multiple different
dlls being loaded in the same namespace.
2023-05-30 16:05:06 +02:00

20 lines
420 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <dlfcn.h>
#include <stdlib.h>
#include "macro.h"
int main(int argc, char **argv) {
void *handles[argc - 1];
int i;
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;
}