2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <exec/execbase.h>
11 #include <exec/lists.h>
12 #include <exec/libraries.h>
13 #include <aros/libcall.h>
14 #include <proto/exec.h>
16 #include "exec_debug.h"
18 /*****************************************************************************
22 AROS_LH2(struct Library
*, OpenLibrary
,
25 AROS_LHA(CONST_STRPTR
, libName
, A1
),
26 AROS_LHA(ULONG
, version
, D0
),
29 struct ExecBase
*, SysBase
, 92, Exec
)
32 Opens a library given by name and revision. If the library does not
33 exist in the current system shared library list, the first the
34 system ROMTag module list is tried. If this fails, and the DOS is
35 running, then the library will be loaded from disk.
38 libName - Pointer to the library's name.
39 version - the library's version number.
42 Pointer to library structure or NULL.
55 *****************************************************************************/
59 struct Library
* library
;
61 DRAMLIB("OpenLibrary(\"%s\", %ld)", libName
, version
);
63 /* Arbitrate for the library list */
66 /* Look for the library in our list */
67 library
= (struct Library
*) FindName (&SysBase
->LibList
, libName
);
69 /* Something found ? */
73 if(library
->lib_Version
>=version
)
75 /* Call Open vector */
76 library
=AROS_LVO_CALL1(struct Library
*,
77 AROS_LCA(ULONG
,version
,D0
),
78 struct Library
*,library
,1,lib
83 DRAMLIB("Version mismatch (have %ld, wanted %ld)", library
->lib_Version
, version
);
89 * We cannot handle loading libraries from disk. But this is taken
90 * care of by dos.library (well lddemon really) replacing this
91 * function with a SetFunction() call.
97 DRAMLIB("OpenLibrary(\"%s\", %ld) = %p", libName
, version
, library
);