      function ccall.getlib(libname)
*
*
*
*
*
*
*
*
*
$catalog local
*
      $include ccall.common

      call ccall.init

      libname = downcase(libname)

      locate(libname,c.libnames;l) then
         lib.handle = c.libs[(l*4)-3,4]
         return(lib.handle)
      end

      s1 = cc$nul4
      s2 = CC$FN.DLOPEN : libname : CC$NUL : CC$FN.RTN32 : cc$nul4 : CC$FN.EXIT

      lib.handle = ccall(s1,s2)

      if lib.handle = '' or lib.handle = cc$nul4 then
         return('')
      end

      c.libnames<-1> = libname
      c.libs = c.libs : lib.handle

      return(lib.handle)
   end
