dtpic.mui: added MUI4 attributes. (Only attribute
[AROS.git] / arch / all-unix / exec / platform_init.c
blob921181080c9095f915613b70f11f09a5d92e2508
1 #include <aros/debug.h>
2 #include <aros/kernel.h>
3 #include <aros/symbolsets.h>
4 #include <proto/hostlib.h>
6 #include "exec_intern.h"
8 static const char *libc_symbols[] =
10 "exit",
11 #ifdef HAVE_SWAPCONTEXT
12 "getcontext",
13 "makecontext",
14 "swapcontext",
15 #endif
16 NULL
19 static int Platform_Init(struct ExecBase *SysBase)
21 APTR LibCHandle;
22 ULONG r;
24 HostLibBase = OpenResource("hostlib.resource");
25 D(bug("[exec] HostLibBase %p\n", HostLibBase));
26 if (!HostLibBase)
27 return FALSE;
29 /* We use local variable for the handle because we never expunge
30 so we will never close it */
31 LibCHandle = HostLib_Open(LIBC_NAME, NULL);
32 D(bug("[exec] libc handle 0x%p\n", LibCHandle));
33 if (!LibCHandle)
34 return FALSE;
36 PD(SysBase).SysIFace = (struct LibCInterface *)HostLib_GetInterface(LibCHandle, libc_symbols, &r);
37 if (PD(SysBase).SysIFace)
39 D(bug("[exec] Got libc interface, %u unresolved symbols\n", r));
40 if (!r)
41 return TRUE;
43 HostLib_DropInterface((APTR *)PD(SysBase).SysIFace);
44 HostLib_Close(LibCHandle, NULL);
47 return FALSE;
50 ADD2INITLIB(Platform_Init, 0);