HALF ECHO LEARN / REFERENCE COLLECTION

v262.2

src/test/test-dlopen.c

Git blob: 691905bde5bda361f57da068b173010b6044ef1b

Lines 1–21 of 21

/* SPDX-License-Identifier: LGPL-2.1-or-later */
 
#include <dlfcn.h>
#include <stdlib.h>
 
#include "dlfcn-util.h"
#include "forward.h"
 
int main(int argc, char **argv) {
        void *handles[argc - 1];
        int i;
 
        for (i = 0; i < argc - 1; i++)
                assert_se(dlopen_safe(argv[i + 1], handles + i, /* reterr_dlerror= */ NULL) >= 0);
 
        for (i--; i >= 0; i--)
                assert_se(dlclose(handles[i]) == 0);
 
        return EXIT_SUCCESS;
}