src/test/test-dlopen.c
raw| 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 | |
| 3 | #include <dlfcn.h> |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | #include "dlfcn-util.h" |
| 7 | #include "shared-forward.h" |
| 8 | |
| 9 | int main(int argc, char **argv) { |
| 10 | void *handles[argc - 1]; |
| 11 | int i; |
| 12 | |
| 13 | for (i = 0; i < argc - 1; i++) |
| 14 | assert_se(dlopen_safe(argv[i + 1], handles + i, /* reterr_dlerror= */ NULL) >= 0); |
| 15 | |
| 16 | for (i--; i >= 0; i--) |
| 17 | assert_se(dlclose(handles[i]) == 0); |
| 18 | |
| 19 | return EXIT_SUCCESS; |
| 20 | } |