[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

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