* as/link/lklib.c, as/link/lksdcclib.c, as/link/lklibr.h,
[fw/sdcc] / as / link / lklibr.h
1 /* lklibr.h */
2
3 /*
4  * (C) Copyright 1989-1995
5  * All Rights Reserved
6  *
7  * Alan R. Baldwin
8  * 721 Berkeley St.
9  * Kent, Ohio  44240
10  *
11  * With contributions for the
12  * object libraries from
13  * Ken Hornstein
14  * kenh@cmf.nrl.navy.mil
15  *
16  */
17
18 /*
19  * Extensions: P. Felber
20  */
21
22 #ifndef __LKLIBR_H
23 #define __LKLIBR_H
24
25 #include <stdio.h>
26
27 typedef struct slibrarysymbol mlibrarysymbol;
28 typedef struct slibrarysymbol *pmlibrarysymbol;
29
30 struct slibrarysymbol
31 {
32   char *name;                   /*Warning: allocate memory before using */
33   pmlibrarysymbol next;
34 };
35
36 typedef struct slibraryfile mlibraryfile;
37 typedef struct slibraryfile *pmlibraryfile;
38
39 struct slibraryfile
40 {
41   int loaded;
42   char *libspc;
43   char *relfil;                 /* Warning: allocate memory before using */
44   char *filename;               /* Warning: allocate memory before using */
45   long offset;                  /* The embedded file offset in the library file libspc */
46   unsigned int type;
47   pmlibrarysymbol symbols;
48   pmlibraryfile next;
49 };
50
51 extern pmlibraryfile libr;
52
53 #ifdef INDEXLIB
54 pmlibrarysymbol add_rel_index (FILE * fp, long size, pmlibraryfile This);
55 #else
56 int add_rel_file (const char *name, struct lbname *lbnh, const char *relfil,
57                   const char *filspc, int offset, FILE * fp, long size, int type);
58 #endif
59
60 struct aslib_target
61 {
62   int (*is_lib) (FILE * libfp);
63 #ifdef INDEXLIB
64     pmlibraryfile (*buildlibraryindex) (struct lbname * lbnh, FILE * libfp, pmlibraryfile This, int type);
65 #else
66   int (*fndsym) (const char *name, struct lbname * lbnh, FILE * libfp, int type);
67 #endif
68   void (*loadfile) (struct lbfile * lbfh);
69 };
70
71 extern struct aslib_target aslib_target_sdcclib;
72 extern struct aslib_target aslib_target_lib;
73
74 #endif /* __LKLIBR_H */