Autodoc corrections
[cake.git] / rom / exec / openlibrary.c
blob5b4336fe116c2be2e84b674c8b421f6b567b9377
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Open a library.
6 Lang: english
7 */
8 #include <exec/execbase.h>
9 #include <exec/lists.h>
10 #include <exec/libraries.h>
11 #include <aros/libcall.h>
12 #include <proto/exec.h>
14 /*****************************************************************************
16 NAME */
18 AROS_LH2(struct Library *, OpenLibrary,
20 /* SYNOPSIS */
21 AROS_LHA(CONST_STRPTR, libName, A1),
22 AROS_LHA(ULONG, version, D0),
24 /* LOCATION */
25 struct ExecBase *, SysBase, 92, Exec)
27 /* FUNCTION
28 Opens a library given by name and revision. If the library does not
29 exist in the current system shared library list, the first the
30 system ROMTag module list is tried. If this fails, and the DOS is
31 running, then the library will be loaded from disk.
33 INPUTS
34 libName - Pointer to the library's name.
35 version - the library's version number.
37 RESULT
38 Pointer to library structure or NULL.
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 CloseLibrary()
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 struct Library * library;
57 /* Arbitrate for the library list */
58 Forbid();
60 /* Look for the library in our list */
61 library = (struct Library *) FindName (&SysBase->LibList, libName);
63 /* Something found ? */
64 if(library!=NULL)
66 /* Check version */
67 if(library->lib_Version>=version)
69 /* Call Open vector */
70 library=AROS_LVO_CALL1(struct Library *,
71 AROS_LCA(ULONG,version,D0),
72 struct Library *,library,1,lib
74 }else
75 library=NULL;
79 * We cannot handle loading libraries from disk. But this is taken
80 * care of by dos.library (well lddemon really) replacing this
81 * function with a SetFunction() call.
84 /* All done. */
85 Permit();
86 return library;
87 AROS_LIBFUNC_EXIT
88 } /* OpenLibrary */