This repository has been archived by the owner on Apr 9, 2018. It is now read-only.
forked from adtools/amigaos-cross-toolchain
-
Notifications
You must be signed in to change notification settings - Fork 12
/
simple-library.c
91 lines (72 loc) · 4.22 KB
/
simple-library.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/******************************************************************************/
/* */
/* includes */
/* */
/******************************************************************************/
#include <dos/dosextens.h>
#include <proto/exec.h>
#include <stabs.h>
/******************************************************************************/
/* */
/* exports */
/* */
/******************************************************************************/
const char LibName[]="simple.library";
const char LibIdString[]="version 1.0";
const UWORD LibVersion=1;
const UWORD LibRevision=0;
/******************************************************************************/
/* */
/* global declarations */
/* */
/******************************************************************************/
struct Library *myLibPtr;
struct ExecBase *SysBase;
struct DosLibrary *DOSBase;
/******************************************************************************/
/* */
/* user library initialization */
/* */
/* !!! CAUTION: This function may run in a forbidden state !!! */
/* */
/******************************************************************************/
int __UserLibInit(struct Library *myLib)
{
/* setup your library base - to access library functions over *this* basePtr! */
myLibPtr = myLib;
/* !!! required !!! */
SysBase = *(struct ExecBase **)4L;
return (DOSBase=(struct DosLibrary *)OpenLibrary("dos.library",33L))==NULL;
}
/******************************************************************************/
/* */
/* user library cleanup */
/* */
/* !!! CAUTION: This function runs in a forbidden state !!! */
/* */
/******************************************************************************/
void __UserLibCleanup(void)
{
CloseLibrary(&DOSBase->dl_lib);
}
/******************************************************************************/
/* */
/* library dependent function(s) */
/* */
/******************************************************************************/
ADDTABL_1(__UserFunc,d0); /* One Argument in d0 */
int __UserFunc(long a)
{
return a*2;
}
/******************************************************************************/
/* */
/* endtable marker (required!) */
/* */
/******************************************************************************/
ADDTABL_END();
/******************************************************************************/
/* */
/* end of simplelib.c */
/* */
/******************************************************************************/