DEADSOFTWARE

Port, TODO
[bbcp.git] / Trurl-based / _LinuxOpenBSD_ / Lin / Rsrc / loader / BlackBox-dl.c
1 #include <dlfcn.h>
2 #include <stdio.h>
4 int main (int argc, char *argv[])
5 {
6 void * h;
7 /*
8 void * h1;
9 void (*SetKernelBaseStack) (int);
10 void (*Init) (void);
11 */
12 int res;
14 h = dlopen("libBB.so", RTLD_LAZY | RTLD_GLOBAL);
15 if (h != NULL) {
16 /*
17 h1 = dlsym(h, "SetKernelBaseStack");
18 if (h1 != NULL) {
19 *(void **) (&SetKernelBaseStack) = h1;
20 h1 = dlsym(h, "Init");
21 if (h1 != NULL) {
22 *(void **) (&Init) = h1;
24 asm ("movl %%esp, %[res]" : [res] "=m" (res) );
25 SetKernelBaseStack(res - 8);
27 printf("before Init()\n");
28 Init();
29 printf("after Init()\n");
31 res = 0;
32 } else {
33 perror(dlerror());
34 res = 3;
35 }
36 } else {
37 perror(dlerror());
38 res = 2;
39 }
40 */
41 res = 0;
42 } else {
43 perror(dlerror());
44 res = 1;
45 }
47 return res;
48 }