home *** CD-ROM | disk | FTP | other *** search
- #ifdef __GNUC__
- #include <inline/exec.h>
-
- #ifdef SMALL_DATA /* Kludge to fix non-working inline function */
- static void rawdofmt(UBYTE *a,APTR b,void (*c)(),APTR d)
- { RawDoFmt(a,b,c,d); }
- #define RawDoFmt rawdofmt
- #endif
-
- #endif
- #include <stabs.h>
-
- extern struct lib /* These are the elements pointed to by __LIB_LIST__ */
- { struct Library *base;
- char *name;
- } *__LIB_LIST__[];
-
- extern void __request(const char *text);
- extern ULONG __oslibversion;
- extern void exit(int returncode);
-
- extern void writeone(void);
- asm(".text;.even;_writeone:;moveb d0,a3@+;rts");
-
- void __initlibraries(void)
- { ULONG version=__oslibversion;
- struct lib **list=&__LIB_LIST__[1];
- while(*list!=NULL)
- { if(((*list)->base=OpenLibrary((*list)->name,version))==NULL)
- { char buf[60];
- ULONG a[2];
- a[0]=version;
- a[1]=(ULONG)(*list)->name;
- RawDoFmt("Need version %.10ld of %.32s",a,&writeone,buf);
- __request(buf);
- exit(20);
- }
- list++;
- }
- }
-
- void __exitlibraries(void)
- { struct lib **list=&__LIB_LIST__[1];
- while(*list!=NULL)
- { if((*list)->base!=NULL)
- CloseLibrary((*list)->base);
- *list++=NULL; }
- }
-
- ADD2INIT(__initlibraries,-60);
- ADD2EXIT(__exitlibraries,-60);
-