

Slbopen(2)                Programmer's Manual                 Slbopen(2)




pNAMEq
        Slbopen, Slbclose - shared library functions

pSYNOPSISq
        typedef void *SLB;
        typedef long (*SLB_EXEC) (SLB *slb, long fn, int params, ...);
        
        long Slbopen( const char *name, const char *path, long min_ver,
             SLB *slb, SLB_EXEC *slbexec);
        
        long Slbclose( SLB slb);

pDESCRIPTIONq
        pSlbopenq attaches the shared library pnameq from memory or from the
        directory ppathq  with  a  minimal version number of pmin_verq.  pslbq
        and pslbexecq will be set to the shared library descriptor and the
        shared library entry point.  The call returns a  negative  error
        code  or  the  (positive)  version  number  of the loaded shared
        library.

        The shared library may be closed explicitly with pSlbcloseq before
        the process exits.  No parameter  validation  is  done  for  pslbq
        (passing   an   invalid  descriptor  will  result  in  undefined
        behaviour).

        name
                is the name of the  shared  library.    The  recommended
                extension is  `slb'.    Currently the name comparison is
                case independent, but it is recommended to use the  same
                case in both the library header and the pSlbopenq call for
                compatibility with future versions.  Also note that pnameq
                must not contain the path.

        path
                is  the  path  in  which  the shared library is located.
                When not found here or if a NULL was passed the  library
                will  be  searched  in  a  default  list  of   locations
                specified by the environment variable SLBPATH.
                Note that the library might use the path during the init
                call to locate  additional files -- it  depends  on  the
                particular library whether or not it is  able to process
                a relative path specification properly.

        min_ver
                is  the  minimal  version number of the library to load.
                It is  implementation  dependent  whether  pSlbopenq  will
                attempt  to load a shared library from a different place
                if the first library found is too old  (the  SLBLOAD.OVL
                for MetaDOS will attempt to do this).

        slb
                is  the descriptor for the shared library, to be used in
                library calls and when closing the shared  library  with



Atari TOS                 Release: 1998-10-20                     Page 1




Slbopen(2)                Programmer's Manual                 Slbopen(2)



                pSlbclose.q

        slbexec
                is the library entry point.

        Library  calls  are  done  through the returned pslbexecq function
        pointer.   The  calling  convention  is  identical   to   GEMDOS
        (register preservation and parameter passing on the stack).

        slb
                is the shared library descriptor returned by Slbopen.

        params
                is the total size of additional parameters passed on the
                stack, counted in 16 bit words.

        fn
                is the  index  of the shared library function.  If a non
                existent library function is called, pslbexecq will return
                EINVFN (this can happen when pfnq is too high or  the  as-
                sociated  function  pointer  in  the  shared  library is
                NULL).

pIMPLEMENTATIONq
        pSlbopenq and pSlbcloseq are GEMDOS calls 0x16 and 0x17.

pENVIRONMENTq

        SLBPATH
                List of paths in which to  look  for  shared  libraries.
                The entries are separated by ',' or ';'.

pRETURNSq

        positive
                The  version number of the loaded shared library (may be
                0).

        EINVFN
                This GEMDOS does not support shared  libraries,  or  the
                called shared library function does not exist.

        EFILNF
                Shared library not found.

        EPLFMT
                Not  a valid GEMDOS program file or shared library magic
                missing from header.

        ERANGE
                Wrong version number (library too old).

        EXCPT
                Shared library crashed during startup.



Atari TOS                 Release: 1998-10-20                     Page 2




Slbopen(2)                Programmer's Manual                 Slbopen(2)



        other
                Other negative error codes may also be returned.

pSEE ALSOq
        slb (5)




















































Atari TOS                 Release: 1998-10-20                     Page 3


