

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




pNAMEq
        Slbopen, Slbclose - shared library functions

pSYNOPSISq
        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);

pDESCRIPTIONq
        pSlbopenq attaches the shared library pnameq from memory or from the
        directory ppathq  with  a  minimal version number of pmin_verq.  pslbq
        and pslbexecq 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 pSlbcloseq before
        the process exits.  No parameter  validation  is  done  for  pslbq
        (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 pSlbopenq call for
                compatibility with future versions.  Also note that pnameq
                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.

        min_ver
                is the minimal version number of the  library  to  load.
                It  is  implementation  dependent  whether  pSlbopenq 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
                pSlbclose.q

        slbexec
                is the library entry point.



Atari TOS                 Release: 1998-07-12                     Page 1




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



        Library calls are done through  the  returned  pslbexecq  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 bytes.

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

pIMPLEMENTATIONq
        pSlbopenq and pSlbcloseq are GEMDOS calls 0x16 and 0x17.

pENVIRONMENTq

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

pRETURNSq

        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.

        other
                Other negative error codes may also be returned.





Atari TOS                 Release: 1998-07-12                     Page 2




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



pSEE ALSOq
        slb (5)























































Atari TOS                 Release: 1998-07-12                     Page 3


