2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
5 Desc: autoinit library - automatic library opening/closing handling
9 #include <proto/exec.h>
11 #include <aros/symbolsets.h>
12 #include <aros/autoinit.h>
13 #include <intuition/intuition.h>
14 #include <dos/dosextens.h>
15 #include <proto/intuition.h>
16 #include <proto/dos.h>
21 AROS_MAKE_ASM_SYM(int, dummy
, __includelibrarieshandling
, 0);
22 AROS_EXPORT_ASM_SYM(__includelibrarieshandling
);
24 int set_open_libraries_list(const void *list
[])
27 struct libraryset
*set
;
29 ForeachElementInSet(list
, 1, pos
, set
)
31 LONG version
= *set
->versionptr
;
36 version
= -(version
+ 1);
40 *set
->baseptr
= OpenLibrary(set
->name
, version
);
42 if (!do_not_fail
&& *set
->baseptr
== NULL
)
46 "Could not open version %ld or higher of library \"%s\".",
47 (const IPTR
[]){version
, set
->name
}
57 void set_close_libraries_list(const void *list
[])
60 struct libraryset
*set
;
62 ForeachElementInSet(SETNAME(LIBS
), 1, pos
, set
)
65 CloseLibrary(*set
->baseptr
);