Most of the routines that make up the Amiga's operating system are
organized into groups called libraries. In order to call a function on
the Amiga you must first open the library that contains the function. For
example, if you want to call the Read() function to read data from disk
you must first open the DOS library.
The system's master library, called Exec, is always open. Exec keeps
track of all the other libraries and is in charge of opening and closing
them. One Exec function, OpenLibrary(), is used to open all the other
libraries.
Almost any program you write for the Amiga will have to call the
OpenLibrary() function. Usage is as follows:
struct Library *LibBase; /* Global: declare this above main() */
main()
{
LibBase = OpenLibrary("library.name",version);
if(!LibBase) { /* Library did not open, so exit */ }
else { /* Library opened, so use its functions */ }
}
LibBase
This is a pointer to the library structure in memory, often referred
to as the library base. The library base must be global because the
system uses it to handle the library's function calls. The name of
this pointer is established by the system (you cannot use any name
you want). Refer to the list below for the appropriate name.
library.name
This is a C string that describes the name of the library you wish to
open. The list of Amiga library names is given below.
version
This should be set to the earliest acceptable library version. A
value of 0 matches any version. A value of 33 means you require at
least version 33, or a later version of the library. If the library
version in the system is older than the one you specify,
OpenLibrary() will fail (return 0).
The following table shows all the function libraries that are currently
part of the Amiga system software. Column one shows the name string to
use with OpenLibrary(); column two shows the name of the global variable
you should use to hold the pointer to the library; column three shows the
oldest version of the library still in use.
Table 1-1: Parameters to Use With OpenLibrary()
Oldest Version
Library Name Library Base Name In Use
(library.name)* (LibBase) (version)
-------------- ----------------- --------------
asl.library AslBase 36
commodities.library CxBase 36
diskfont.library DiskfontBase 33
dos.library DOSBase 33
exec.library SysBase 33
expansion.library ExpansionBase 33
gadtools.library GadToolsBase 36
graphics.library GfxBase 33
icon.library IconBase 33
iffparse.library IFFParseBase 36
intuition.library IntuitionBase 33
keymap.library KeymapBase 33
layers.library LayersBase 33
mathffp.library MathBase 33
mathtrans.library MathTransBase 33
mathieeedoubbas.library MathIeeeDoubBasBase 33
mathieeedoubtrans.library MathIeeeDoubTransBase 33
mathieeesingbas.library MathIeeeSingBasBase 33
mathieeesingtrans.library MathIeeeSingTransBase 33
rexxsyslib.library RexxSysBase 36
translator.library TranslatorBase 33
utility.library UtilityBase 36
wb.library WorkbenchBase 33
* Other libraries may exist that are not supplied by Amiga, Inc. since
it is a feature of the operating system to allow such libraries.
Opening a Library in C Another Kind of Function Library
Opening a Library in Assembler Libraries, Devices and Resources
[Back to Amiga Developer Docs]