Debian Codegraph @

pysobug/mypy.c

raw symbols SCIP
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <dlfcn.h>
4
5 typedef int (*mypy_run_fn)(int argc, const char** argv);
6
7 int main(int argc, const char** argv)
8 {
9 void* handle;
10 mypy_run_fn mypy_run;
11
12 // This one works
13 handle = dlopen("./mypydl.so", RTLD_LAZY | RTLD_GLOBAL);
14 // This one not
15 //handle = dlopen("./mypydl.so", RTLD_LAZY);
16 if (handle == NULL) {
17 fprintf(stderr, "mypy: error: %s\n", dlerror());
18 return 1;
19 }
20
21 mypy_run = (mypy_run_fn) dlsym(handle, "mypy_run");
22 if (mypy_run == NULL) {
23 fprintf(stderr, "mypy: error: %s\n", dlerror());
24 return 2;
25 }
26
27 mypy_run(argc - 1, argv + 1);
28
29 dlclose(handle);
30 return 0;
31 }