Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 1
#include"ld-dll.h"
2
#include"dll_desc.h"
3
 
4
dll_t * main_program;
5
 
6
static char * std_dll_paths[]={
7
 "/rd/1/",
8
 "/hd/1/menuetos/",
9
 "/hd/1/menuetos/dll/",
10
 "./",
11
 NULL
12
};
13
 
14
static char dll_name_buf[1024];
15
 
16
dll_t * do_load_dll(
17
void main(void)
18
{
19
 init_dll();
20
 main_program=load_dll("/rd/1/test.app");
21
 if(!main_program)
22
 {
23
  dprintf("Main load failed\n");
24
  exit(-1);
25
 }
26
 { dll_t * tmp;
27
 if(!(tmp=load_dll("/rd/1/vcrt.dll")))
28
 {
29
  dprintf("Unable to load vcrt.dll\n");
30
  exit(-1);
31
 }
32
 dprintf("Looking for entry point\n");
33
 tmp->entry_point=(void *)mcoff_get_ref(tmp->obj,"_DllMain");
34
 if(tmp->entry_point) tmp->entry_point();
35
 if(!(tmp=load_dll("MOSKRNL.SO")))
36
  if(!(tmp=load_dll("/RD/1/MOSKRNL.SO")))
37
   if(!(tmp=load_dll("/HD/1/MENUETOS/MOSKRNL.SO")))
38
   {
39
    dprintf("Unable to load moskrnl.so\n");
40
    exit(-1);
41
   }
42
 tmp->entry_point=(void *)mcoff_get_ref(tmp->obj,"_DllMain");
43
 if(tmp->entry_point) tmp->entry_point();
44
 }
45
 relocate_dlls();
46
 main_program->entry_point=(void *)mcoff_get_ref(main_program->obj,"_main");
47
 if(!main_program->entry_point)
48
 {
49
  dprintf("Failed to find main program entry point\n");
50
  exit(-1);
51
 }
52
 main_program->entry_point();
53
 exit(0);
54
}