2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
8 #include <aros/config.h>
9 #include <exec/execbase.h>
11 #include <aros/libcall.h>
12 #include <proto/exec.h>
14 #include "exec_debug.h"
15 #ifndef DEBUG_CloseLibrary
16 # define DEBUG_CloseLibrary 0
19 #if DEBUG_CloseLibrary
22 #include <aros/debug.h>
25 /*****************************************************************************
29 AROS_LH1(void, CloseLibrary,
32 AROS_LHA(struct Library *, library, A1),
35 struct ExecBase *, SysBase, 69, Exec)
38 Closes a previously opened library. It is legal to call this function
42 library - Pointer to library structure or NULL.
57 ******************************************************************************/
62 D(bug("CloseLibrary $%lx (\"%s\") by \"%s\"\n", library,
63 library ? library->lib_Node.ln_Name : "(null)",
64 THISCPU->ThisTask->tc_Node.ln_Name));
66 /* Something to do? */
69 ASSERT_VALID_PTR(library);
71 /* Single-thread the close routine. */
75 seglist = AROS_LVO_CALL0(BPTR,struct Library *,library,2,);
77 Normally you'd expect the library to be expunged if this returns
78 non-zero, but this is only exec which doesn't know anything about
79 seglists - therefore dos.library has to SetFunction() into this
80 vector for the additional functionality.
88 /* Local vars not guaranteed to be initialised to 0. I initialise
89 it here to save an assignment in case the close went ok (common
90 path optimization). */
94 AROS_COMPAT_SETD0(seglist);