Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / exec / addlibrary.c
blobcac50945eb67db9fffe28285856f1f83a08bcc57
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a library to the public list of libraries.
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
17 AROS_LH1(void, AddLibrary,
19 /* SYNOPSIS */
20 AROS_LHA(struct Library *, library,A1),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 66, Exec)
25 /* FUNCTION
26 Adds a given library to the system's library list after checksumming
27 the library vectors. This function is not for general use but
28 (of course) for building shared librarys that don't use exec's
29 MakeLibrary() mechanism.
31 INPUTS
32 library - Pointer to a ready for use library structure.
34 RESULT
36 NOTES
37 Some old Amiga software expects that AddLibrary returns the
38 library which was just added. When in binary compatibility mode
39 AROS does this too.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 RemLibrary(), MakeLibrary(), MakeFunctions(), InitStruct(), SumLibrary().
48 INTERNALS
50 ******************************************************************************/
52 AROS_LIBFUNC_INIT
54 ASSERT_VALID_PTR(library);
56 /* Just in case the user forgot them */
57 library->lib_Node.ln_Type=NT_LIBRARY;
58 library->lib_Flags|=LIBF_CHANGED;
60 /* Build checksum for library vectors */
61 SumLibrary(library);
63 /* Arbitrate for the library list */
64 Forbid();
66 /* And add the library */
67 Enqueue(&SysBase->LibList,&library->lib_Node);
69 /* All done. */
70 Permit();
71 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
73 Kludge to force the library to register d0.
74 Some libraries seem to use this side effect in
75 their init code.
78 /* Put the library base in register d0 */
79 register struct Library *ret __asm("d0") = library;
81 /* Make sure the above assignment isn't optimized away */
82 __asm __volatile("": : "r" (ret));
84 #endif
86 AROS_LIBFUNC_EXIT
87 } /* AddLibrary */