OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [linux/] [uClibc/] [test/] [dlopen/] [test1.c] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
#include <fcntl.h>
2
#include <stdlib.h>
3
#include <stdio.h>
4
#include <dlfcn.h>
5
 
6
#ifdef __UCLIBC__
7
extern void _dlinfo(void);
8
#endif
9
 
10
int main(int argc, char **argv) {
11
        void *handle;
12
        int (*mydltest)(const char *s);
13
        char *error;
14
 
15
        handle = dlopen ("./libtest1.so", RTLD_LAZY);
16
        if (!handle) {
17
                fprintf(stderr, "Could not open ./libtest1.so: %s\n", dlerror());
18
                exit(1);
19
        }
20
 
21
        mydltest = dlsym(handle, "dltest");
22
        if ((error = dlerror()) != NULL)  {
23
                fprintf(stderr, "Could not locate symbol 'dltest': %s\n", error);
24
                exit(1);
25
        }
26
 
27
        mydltest("hello world!");
28
 
29
        dlclose(handle);
30
 
31
        return EXIT_SUCCESS;
32
}
33
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.