3 #include <aros/debug.h>
4 #include <aros/kernel.h>
5 #include <aros/libcall.h>
6 #include <aros/symbolsets.h>
7 #include <proto/exec.h>
8 #include <proto/kernel.h>
9 #include <proto/utility.h>
11 #include "../kernel/hostinterface.h"
12 #include "hostlib_intern.h"
14 #include LC_LIBDEFS_FILE
16 AROS_LH2(void *, HostLib_Open
,
17 AROS_LHA(const char *, filename
, A0
),
18 AROS_LHA(char **, error
, A1
),
19 struct HostLibBase
*, HostLibBase
, 1, HostLib
)
23 return HostLibBase
->HostIFace
->HostLib_Open(filename
, error
);
28 AROS_LH2(BOOL
, HostLib_Close
,
29 AROS_LHA(void *, handle
, A0
),
30 AROS_LHA(char **, error
, A1
),
31 struct HostLibBase
*, HostLibBase
, 2, HostLib
)
35 return HostLibBase
->HostIFace
->HostLib_Close(handle
, error
);
40 AROS_LH3(void *, HostLib_GetPointer
,
41 AROS_LHA(void *, handle
, A0
),
42 AROS_LHA(const char *, symbol
, A1
),
43 AROS_LHA(char **, error
, A2
),
44 struct HostLibBase
*, HostLibBase
, 3, HostLib
)
48 return HostLibBase
->HostIFace
->HostLib_GetPointer(handle
, symbol
, error
);
53 AROS_LH1(void, HostLib_FreeErrorStr
,
54 AROS_LHA(char *, error
, A0
),
55 struct HostLibBase
*, HostLibBase
, 4, HostLib
)
59 HostLibBase
->HostIFace
->HostLib_FreeErrorStr(error
);
64 AROS_LH3(APTR
*, HostLib_GetInterface
,
65 AROS_LHA(void *, handle
, A0
),
66 AROS_LHA(const char **, symtable
, A1
),
67 AROS_LHA(ULONG
*, unresolved
, A2
),
68 struct HostLibBase
*, HostLibBase
, 5, HostLib
)
76 for (c
= symtable
; *c
; c
++)
79 iface
= AllocVec(cnt
, MEMF_CLEAR
);
81 cnt
= HostLibBase
->HostIFace
->HostLib_GetInterface(handle
, symtable
, iface
);
91 AROS_LH1I(void, HostLib_DropInterface
,
92 AROS_LHA(APTR
*, interface
, A0
),
93 struct HostLibBase
*, HostLibBase
, 6, HostLib
)
103 static int HostLib_Init(LIBBASETYPEPTR LIBBASE
)
105 struct UtilityBase
*UlitityBase
;
107 struct TagItem
*BootInfo
;
109 UtilityBase
= (struct UtilityBase
*)OpenLibrary("utility.library", 36);
110 D(bug("[hostlib] UtilityBase = 0x%08lX\n", UtilityBase
));
112 KernelBase
= OpenResource("kernel.resource");
113 D(bug("[hostlib] KernelBase = 0x%08lX\n", KernelBase
));
115 BootInfo
= KrnGetBootInfo();
116 HostLibBase
->HostIFace
= (struct HostInterface
*)GetTagData(KRN_HostInterface
, 0, BootInfo
);
117 D(bug("[hostlib] HostIFace = 0x%08lX\n", HostLibBase
->HostIFace
));
119 CloseLibrary((struct Library
*)UtilityBase
);
121 return (int)HostLibBase
->HostIFace
;
124 ADD2INITLIB(HostLib_Init
, 0)