2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Add a library to the public list of libraries.
8 #include <aros/debug.h>
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
15 #include "exec_intern.h"
16 #include "exec_debug.h"
18 /*****************************************************************************
22 AROS_LH1(void, AddLibrary
,
25 AROS_LHA(struct Library
*, library
,A1
),
28 struct ExecBase
*, SysBase
, 66, Exec
)
31 Adds a given library to the system's library list after checksumming
32 the library vectors. This function is not for general use but
33 (of course) for building shared libraries that don't use exec's
34 MakeLibrary() mechanism.
37 library - Pointer to a ready for use library structure.
42 Some old Amiga software expects that AddLibrary returns the
43 library which was just added. When in binary compatibility mode
51 RemLibrary(), MakeLibrary(), MakeFunctions(), InitStruct(), SumLibrary()
55 ******************************************************************************/
59 ASSERT_VALID_PTR(library
);
61 /* Just in case the user forgot them */
62 library
->lib_Node
.ln_Type
=NT_LIBRARY
;
63 library
->lib_Flags
|=LIBF_CHANGED
;
65 /* Build checksum for library vectors */
68 /* Arbitrate for the library list */
71 /* And add the library */
72 Enqueue(&SysBase
->LibList
,&library
->lib_Node
);
78 * When debug.library is added, open it and cache its base instantly.
79 * We do it because symbol lookup routines can be called in a system crash
80 * condition, where calling OpenLibrary() can be dangerous.
82 if (!strcmp(library
->lib_Node
.ln_Name
, "debug.library"))
84 /* Don't bother searching for just added library, just call open vector */
85 DebugBase
= AROS_LVO_CALL1(struct Library
*,
86 AROS_LCA(ULONG
, 0, D0
),
87 struct Library
*, library
, 1, lib
);
89 DINIT("%s added, base 0x%p", library
->lib_Node
.ln_Name
, DebugBase
);
92 AROS_COMPAT_SETD0(library
);