botsense/bsProxy/bsProxyMod.c
static void *ModDllOpen(const char *sModUri)
{
  DListStrIter_T  iter;             ///< paths dlist iterator
  char           *sPath;            ///< a dll path
  char           *sFqPath;          ///< fully qualified path name
  void           *dllHandle = NULL; ///< loaded dll handle

  if( sModUri == NULL )
  {
    return NULL;
  }

  // clear any existing error
  dlerror();

  // 
  // Module path name is an absolute path. No search is made, simply let
  // dlopen() do the work.
  //
  if( PathIsAbsolute(sModUri) )
  {
    if( (sFqPath = NewRealPath(sModUri)) != NULL )
    {
      LOGDIAG3("%s: trying dlopen(\"%s\").", ServerHasName(), sFqPath);
      dllHandle = dlopen(sFqPath, RTLD_LAZY | RTLD_GLOBAL);
      delete(sFqPath);
    }
  }

  //
  // Search list of paths for the module's location and load.
  //
  else
  {
    for(sPath=DListStrIterDataFirst(BsModDllPaths, &iter), dllHandle=NULL;
        sPath!=NULL && dllHandle==NULL;
        sPath=DListStrIterDataNext(&iter))
    {
      if( (sFqPath = NewJoinedPath(sPath, sModUri)) != NULL )
      {
        LOGDIAG3("%s: trying dlopen(\"%s\").", ServerHasName(), sFqPath);
        dllHandle = dlopen(sFqPath, RTLD_LAZY | RTLD_GLOBAL);
        delete(sFqPath);
      }
    }

    //
    // Use dlopen() default search.
    //
    if( dllHandle == NULL )
    {
      LOGDIAG3("%s: trying dlopen(\"%s\").", ServerHasName(), sModUri);
      dllHandle = dlopen(sModUri, RTLD_LAZY | RTLD_GLOBAL);
    }
  }

  if( dllHandle == NULL )
  {
    BSPROXY_MOD_LOG_ERROR(sModUri, BS_ECODE_NO_MOD, "%s.", dlerror());
  }

  return dllHandle;
}
/*!
 * \brief Dynamically load bsProxy server compatible interface module library.
 *
 * If the module path name is absolute, the only library at that location is
 * attempted to be loaded. Otherwise, a series of path locations are searched for
 * the library.
 *
 * \note The dlopen() and dlclose() functions only load/unload when a library 
 * iff the internal reference count is zero. However, bsProxy also needs to track
 * the reference count, which the dl interface does not provide access to.
 *
 * \param sModUri   Expanded, canonical name of the interface module.
 *
 * \return
 * On success, returns DLL handle.\n
 * On failure, returns NULL.
 */
\brief Dynamically load bsProxy server compatible interface module library.
If the module path name is absolute, the only library at that location is
attempted to be loaded. Otherwise, a series of path locations are searched for
the library.

\note The dlopen() and dlclose() functions only load/unload when a library
iff the internal reference count is zero. However, bsProxy also needs to track
the reference count, which the dl interface does not provide access to.

\param sModUri   Expanded, canonical name of the interface module.

\return
On success, returns DLL handle.\n
On failure, returns NULL.
\ brief Dynamically load bsProxy server compatible interface module library . If the module path name is absolute the only library at that location is attempted to be loaded . Otherwise a series of path locations are searched for the library . \ note The dlopen () and dlclose () functions only load / unload when a library iff the internal reference count is zero . However bsProxy also needs to track the reference count which the dl interface does not provide access to . \ param sModUri Expanded canonical name of the interface module . \ return On success returns DLL handle . \ n On failure returns NULL .
static void *ModDllOpen(const char *sModUri)
{
  DListStrIter_T  iter;             
  char           *sPath;            
  char           *sFqPath;          
  void           *dllHandle = NULL; 
  if( sModUri == NULL )
  {
    return NULL;
  }
  dlerror();
  Module path name is an absolute path. No search is made, simply let
  dlopen() do the work.
  if( PathIsAbsolute(sModUri) )
  {
    if( (sFqPath = NewRealPath(sModUri)) != NULL )
    {
      LOGDIAG3("%s: trying dlopen(\"%s\").", ServerHasName(), sFqPath);
      dllHandle = dlopen(sFqPath, RTLD_LAZY | RTLD_GLOBAL);
      delete(sFqPath);
    }
  }
  Search list of paths for the module's location and load.
  else
  {
    for(sPath=DListStrIterDataFirst(BsModDllPaths, &iter), dllHandle=NULL;
        sPath!=NULL && dllHandle==NULL;
        sPath=DListStrIterDataNext(&iter))
    {
      if( (sFqPath = NewJoinedPath(sPath, sModUri)) != NULL )
      {
        LOGDIAG3("%s: trying dlopen(\"%s\").", ServerHasName(), sFqPath);
        dllHandle = dlopen(sFqPath, RTLD_LAZY | RTLD_GLOBAL);
        delete(sFqPath);
      }
    }
    Use dlopen() default search.
    if( dllHandle == NULL )
    {
      LOGDIAG3("%s: trying dlopen(\"%s\").", ServerHasName(), sModUri);
      dllHandle = dlopen(sModUri, RTLD_LAZY | RTLD_GLOBAL);
    }
  }
  if( dllHandle == NULL )
  {
    BSPROXY_MOD_LOG_ERROR(sModUri, BS_ECODE_NO_MOD, "%s.", dlerror());
  }
  return dllHandle;
}
static void * ModDllOpen ( const char * sModUri ) { DListStrIter_T iter ; char * sPath ; char * sFqPath ; void * dllHandle = NULL ; if ( sModUri == NULL ) { return NULL ; } dlerror ( ) ; if ( PathIsAbsolute ( sModUri ) ) { if ( ( sFqPath = NewRealPath ( sModUri ) ) != NULL ) { LOGDIAG3 ( " \" \" " , ServerHasName ( ) , sFqPath ) ; dllHandle = dlopen ( sFqPath , RTLD_LAZY | RTLD_GLOBAL ) ; delete ( sFqPath ) ; } } else { for ( sPath = DListStrIterDataFirst ( BsModDllPaths , & iter ) , dllHandle = NULL ; sPath != NULL && dllHandle == NULL ; sPath = DListStrIterDataNext ( & iter ) ) { if ( ( sFqPath = NewJoinedPath ( sPath , sModUri ) ) != NULL ) { LOGDIAG3 ( " \" \" " , ServerHasName ( ) , sFqPath ) ; dllHandle = dlopen ( sFqPath , RTLD_LAZY | RTLD_GLOBAL ) ; delete ( sFqPath ) ; } } if ( dllHandle == NULL ) { LOGDIAG3 ( " \" \" " , ServerHasName ( ) , sModUri ) ; dllHandle = dlopen ( sModUri , RTLD_LAZY | RTLD_GLOBAL ) ; } } if ( dllHandle == NULL ) { BSPROXY_MOD_LOG_ERROR ( sModUri , BS_ECODE_NO_MOD , " " , dlerror ( ) ) ; } return dllHandle ; }
\brief Dynamically load bsProxy server compatible interface module library.
\ brief Dynamically load bsProxy server compatible interface module library .
///< paths dlist iterator ///< a dll path ///< fully qualified path name ///< loaded dll handle // clear any existing error //  // Module path name is an absolute path. No search is made, simply let // dlopen() do the work. // // // Search list of paths for the module's location and load. // // // Use dlopen() default search. //