/**
 * Module deactivation
 * @ingroup globus_callout_activation
 */
static
int
globus_l_callout_deactivate(void)
{
    int                                 result = (int) GLOBUS_SUCCESS;
    static char *                       _function_name_ =
        "globus_l_callout_deactivate";

    GLOBUS_I_CALLOUT_DEBUG_ENTER;

    globus_module_deactivate(GLOBUS_COMMON_MODULE);

    GLOBUS_I_CALLOUT_DEBUG_EXIT;

    if(globus_i_callout_debug_fstream != stderr)
    {
        fclose(globus_i_callout_debug_fstream);
    }

#ifndef BUILD_STATIC_ONLY
    result = lt_dlexit();
#endif

    return result;
}
/*
 * Read the directory and load all .so files
 */
vector<AbstractPlugin*> DlOpenPluginLoader::LoadPlugins() {
  AbstractPlugin *plugin = NULL;
  set<string>::iterator iter;
  set<string> plugin_names = FindPlugins(m_dirname);
  vector<AbstractPlugin*> plugins;

  if (!m_dl_active) {
    if (lt_dlinit()) {
      OLA_WARN << "lt_dlinit failed";
      return plugins;
    }
  }

  if (lt_dlsetsearchpath(m_dirname.c_str())) {
    OLA_WARN << "lt_setpath failed";
    lt_dlexit();
    return plugins;
  }
  m_dl_active = true;

  for (iter = plugin_names.begin(); iter != plugin_names.end(); ++iter) {
    string path = m_dirname;
    path.append("/");
    path.append(*iter);

    if ((plugin = this->LoadPlugin(path)))
      plugins.push_back(plugin);
    else
      OLA_WARN << "Failed to load plugin: " << path;
  }
  return plugins;
}
Exemple #3
0
void modena_function_destroy(modena_function_t *self)
{
    lt_dlclose(self->handle);
    lt_dlexit();
    Py_XDECREF(self->pFunction);
    free(self);
}
Exemple #4
0
int init_module_loading()
{
	int ret;
	static int initialised=0;
	
	if (initialised){
		LOG(L_CRIT, "BUG: init_module_loading: already intialised\n");
		return -1;
	}
	/* make sure preloaded modules are initialised */
	/*LTDL_SET_PRELOADED_SYMBOLS();*/
	ret=lt_dlinit();
	
	if (ret){
		LOG(L_CRIT, "ERROR: init_module_loading: lt_dlinit failed: %s\n",
				lt_dlerror());
		goto error;
	}
	
	ret=lt_dlsetsearchpath(MODULE_SEARCH_PATH);
	if (ret){
		LOG(L_CRIT, "ERROR: init_module_loading: lt_dlsetsearchpath "
					"failed: %s\n",
				lt_dlerror());
		goto error;
	}
	initialised++;
	return ret;
error:
	lt_dlexit();
	return -1;
}
Exemple #5
0
void dbi_shutdown_r(dbi_inst Inst) {
	dbi_inst_t *inst = (dbi_inst_t*) Inst;
	dbi_conn_t *curconn = inst->rootconn;
	dbi_conn_t *nextconn;
	
	dbi_driver_t *curdriver = inst->rootdriver;
	dbi_driver_t *nextdriver;
	
	while (curconn) {
		nextconn = curconn->next;
		dbi_conn_close((dbi_conn)curconn);
		curconn = nextconn;
	}
	
	while (curdriver) {
		nextdriver = curdriver->next;
		curdriver->functions->finalize(curdriver);		
 		_safe_dlclose(curdriver);
		free(curdriver->functions);
		_free_custom_functions(curdriver);
		_free_caps(curdriver->caps);
		free(curdriver->filename);
		free(curdriver);
		curdriver = nextdriver;
	}
#if HAVE_LTDL_H
        (void)lt_dlexit();
#endif	
	free(inst);
}
Exemple #6
0
void sxc_shutdown(sxc_client_t *sx, int signal) {
    if(!sx)
	return;
    if(sx->temptrack.slots) {
	for(int i = 0; i < sx->temptrack.slots; i++) {
	    if(sx->temptrack.names[i]) {
		/* TODO: for win32 we may also need to track descriptors */
		unlink(sx->temptrack.names[i]);
		if(!signal)
		    free(sx->temptrack.names[i]);
	    }
	}
	if(!signal)
	    free(sx->temptrack.names);
    }
    if(!signal) {
        if (sx->log.func && sx->log.func->close) {
            sx->log.func->close(sx->log.func->ctx);
        }
	sxi_filter_unloadall(sx);
	free(sx);
	lt_dlexit();
	curl_global_cleanup();
    }
}
Exemple #7
0
/* deinitialize module routines */
int neb_deinit_modules(void) {

	/* deinitialize library */
	if (lt_dlexit())
		return ERROR;

	return OK;
}
Exemple #8
0
void xdlclose(void *h)
{     xassert(h != NULL);
      if (lt_dlclose(h) != 0)
         xerror("xdlclose: %s\n", lt_dlerror());
      if (lt_dlexit() != 0)
         xerror("xdlclose: %s\n", lt_dlerror());
      return;
}
Exemple #9
0
void
plugins_destroy(void)
{
    PLUGINS_CALL(destroy);
    lt_dlinterface_free(interface_id);
    lt_dlexit();
    VLOG_INFO("Destroyed all plugins");
}
Exemple #10
0
/* Unload all modules */
int modules_shutdown() {
  struct module_entry_t *m;

  MODULE_ITER(m)
    m->unload(m);

  return lt_dlexit(); /* 0 is good */
}
Exemple #11
0
void xdlclose(void *h)
{     /* close dynamically linked library */
      xassert(h != NULL);
      if (lt_dlclose(h) != 0)
         xerror("xdlclose: %s\n", lt_dlerror());
      if (lt_dlexit() != 0)
         xerror("xdlclose: %s\n", lt_dlerror());
      return;
}
void pa_ltdl_done(void) {
    pa_assert_se(lt_dlexit() == 0);

#ifdef PA_BIND_NOW
    /* lt_dlexit() will free our loader vtable, hence reset our
     * pointer to it here */
    bindnow_loader = NULL;
#endif
}
Exemple #13
0
int fontforge_main( int argc, char **argv ) {
    extern const char *source_version_str;
    extern const char *source_modtime_str;

    fprintf( stderr, "Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors.\n" );
    fprintf( stderr, " License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n" );
    fprintf( stderr, " with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.\n" );
    fprintf( stderr, " Based on sources from %s"
#ifdef FREETYPE_HAS_DEBUGGER
	    "-TtfDb"
#endif
#ifdef _NO_PYTHON
	    "-NoPython"
#endif
#ifdef FONTFORGE_CONFIG_USE_DOUBLE
	    "-D"
#endif
	    ".\n",
	    FONTFORGE_MODTIME_STR );
    fprintf( stderr, " Based on source from git with hash:%s\n", FONTFORGE_GIT_VERSION );

    FindProgDir(argv[0]);
    InitSimpleStuff();

    bind_textdomain_codeset("FontForge","UTF-8");
    bindtextdomain("FontForge", getLocaleDir());
    textdomain("FontForge");

    if ( default_encoding==NULL )
	default_encoding=FindOrMakeEncoding("ISO8859-1");
    if ( default_encoding==NULL )
	default_encoding=&custom;	/* In case iconv is broken */
    CheckIsScript(argc,argv);		/* Will run the script and exit if it is a script */
    if ( argc==2 ) {
	char *pt = argv[1];
	if ( *pt=='-' && pt[1]=='-' && pt[2]!='\0') ++pt;
	if ( strcmp(pt,"-usage")==0 )
	    doscriptusage();
	else if ( strcmp(pt,"-help")==0 )
	    doscripthelp();
	else if ( strcmp(pt,"-version")==0 || strcmp(pt,"-v")==0 || strcmp(pt,"-V")==0 )
	    doversion(FONTFORGE_MODTIME_STR);
    }
#  if defined(_NO_PYTHON)
    ProcessNativeScript(argc, argv,stdin);
#  else
    PyFF_Stdin();
#  endif

#ifndef _NO_LIBUNICODENAMES
    uninm_names_db_close(names_db);	/* close this database before exiting */
    uninm_blocks_db_close(blocks_db);
#endif

    lt_dlexit();
return( 0 );
}
Exemple #14
0
/*
 *	Remove the module lists.
 */
int detach_modules(void)
{
	rbtree_free(instance_tree);
	rbtree_free(module_tree);

	lt_dlexit();

	return 0;
}
Exemple #15
0
int fontforge_main( int argc, char **argv ) {
    extern const char *source_version_str;
    extern const char *source_modtime_str;

    fprintf( stderr, "Copyright (c) 2000-2012 by George Williams.\n Executable based on sources from %s"
	    "-ML"
#ifdef FREETYPE_HAS_DEBUGGER
	    "-TtfDb"
#endif
#ifdef _NO_PYTHON
	    "-NoPython"
#endif
#ifdef FONTFORGE_CONFIG_USE_DOUBLE
	    "-D"
#endif
	    ".\n",
	    source_modtime_str );
    fprintf( stderr, " Library based on sources from %s.\n", library_version_configuration.library_source_modtime_string );

    /* I don't bother to check that the exe's exectations of the library are */
    /*  valid. The exe only consists of this file, and so it doesn't care. */
    /*  as long as the library is self consistant, all should be well */
    /* check_library_version(&exe_library_version_configuration,true,false); */

    FindProgDir(argv[0]);
    InitSimpleStuff();

    bind_textdomain_codeset("FontForge","UTF-8");
    bindtextdomain("FontForge", getLocaleDir());
    textdomain("FontForge");

    if ( default_encoding==NULL )
	default_encoding=FindOrMakeEncoding("ISO8859-1");
    if ( default_encoding==NULL )
	default_encoding=&custom;	/* In case iconv is broken */
    CheckIsScript(argc,argv);		/* Will run the script and exit if it is a script */
    if ( argc==2 ) {
	char *pt = argv[1];
	if ( *pt=='-' && pt[1]=='-' ) ++pt;
	if ( strcmp(pt,"-usage")==0 )
	    doscriptusage();
	else if ( strcmp(pt,"-help")==0 )
	    doscripthelp();
	else if ( strcmp(pt,"-version")==0 )
	    doversion(source_version_str);
    }
#  if defined(_NO_PYTHON)
    ProcessNativeScript(argc, argv,stdin);
#  else
    PyFF_Stdin();
#  endif

    uninm_names_db_close(names_db);
    lt_dlexit();
return( 0 );
}
Exemple #16
0
/* return 0 on error */
int nutscan_load_upsclient_library()
{

        if( dl_handle != NULL ) {
                /* if previous init failed */
                if( dl_handle == (void *)1 ) {
                        return 0;
                }
                /* init has already been done */
                return 1;
        }

        if( lt_dlinit() != 0 ) {
                fprintf(stderr, "Error initializing lt_init\n");
                return 0;
        }

        dl_handle = lt_dlopenext(libname);
        if (!dl_handle) {
                dl_error = lt_dlerror();
                goto err;
        }

        lt_dlerror();      /* Clear any existing error */

        *(void **) (&nut_upscli_splitaddr) = lt_dlsym(dl_handle,
                                                        "upscli_splitaddr");
        if ((dl_error = lt_dlerror()) != NULL)  {
                goto err;
        }

        *(void **) (&nut_upscli_tryconnect) = lt_dlsym(dl_handle,
							"upscli_tryconnect");
        if ((dl_error = lt_dlerror()) != NULL)  {
                goto err;
        }

        *(void **) (&nut_upscli_list_start) = lt_dlsym(dl_handle,
							"upscli_list_start");
        if ((dl_error = lt_dlerror()) != NULL)  {
                goto err;
        }

        *(void **) (&nut_upscli_list_next) = lt_dlsym(dl_handle,
							"upscli_list_next");
        if ((dl_error = lt_dlerror()) != NULL)  {
                goto err;
        }

        return 1;
err:
        fprintf(stderr, "Cannot load NUT library (%s) : %s. NUT search disabled.\n", libname, dl_error);
        dl_handle = (void *)1;
	lt_dlexit();
        return 0;
}
Exemple #17
0
//-----------------------------------------------------------------------------
mglParser::~mglParser()
{
	DeleteAll();	delete []fval;
	for(size_t i=0;i<NumList.size();i++)	// force delete built-in variables
		if(NumList[i])	delete NumList[i];
	NumList.clear();
#if MGL_HAVE_LTDL
	lt_dlexit();
#endif
}
Exemple #18
0
  static void free_lt_handle(SpellerLtHandle h) 
  {
#ifdef USE_LTDL
    int s;
    s = lt_dlclose((lt_dlhandle)h);
    assert (s == 0);
    s = lt_dlexit();
    assert (s == 0);
#endif
  }
Exemple #19
0
int nv_plugins_free() {
	int ret = 0;

	/* close down the plugin system */
	ret = lt_dlexit();
	if (ret) {
		nv_log(NVLOG_ERROR, "lt_dlexit(): %s", lt_dlerror());
		return -1;
	}
	return ret;
}
Exemple #20
0
int uninit_plugin(void)
{
	int rv;

	rv = lt_dlexit();
	if (rv < 0) {
		dbg("Can not exit ltdl right");
		return -1;
	}
	return 0;
}
Exemple #21
0
WIN32DLL_DEFINE
    int mcrypt_algorithm_module_ok(const char *file, const char *directory)
{
	word32 ret = 1;
	mcrypt_dlhandle _handle;
	void *rr;
	int (*_version) (void);

	if (file == NULL && directory == NULL) {
		return MCRYPT_UNKNOWN_ERROR;
	}

	if (lt_dlinit() != 0) {
		return MCRYPT_UNKNOWN_ERROR;
	}

	rr = mcrypt_dlopen(&_handle, directory, NULL, file);

	if (!rr) {
		lt_dlexit();
		return MCRYPT_UNKNOWN_ERROR;
	}


	_version = mcrypt_dlsym(_handle, "_mcrypt_algorithm_version");

	if (_version == NULL) {
		mcrypt_dlclose(_handle);
		lt_dlexit();
		return MCRYPT_UNKNOWN_ERROR;
	}

	ret = _version();

	mcrypt_dlclose(_handle);

	lt_dlexit();

	return ret;

}
Exemple #22
0
/**
 * oh_exit_ltdl
 *
 * Does everything needed to close the ltdl structures.
 *
 * Returns: 0 on Success.
 **/
int oh_exit_ltdl()
{
    int rv;

    rv = lt_dlexit();
    if (rv < 0) {
        dbg("Could not exit ltdl!");
        return -1;
    }

    return 0;
}
Exemple #23
0
/**
 * oh_exit_ltdl
 *
 * Does everything needed to close the ltdl structures.
 *
 * Returns: 0 on Success.
 **/
static int oh_exit_ltdl(void)
{
        int rv;

        rv = lt_dlexit();
        if (rv < 0) {
                err("Could not exit ltdl!");
                return -1;
        }

        return 0;
}
/*
 * Unload all plugins
 */
void DlOpenPluginLoader::UnloadPlugins() {
  vector<lt_dlhandle>::iterator iter;

  for (iter = m_plugin_handles.begin(); iter != m_plugin_handles.end(); iter++)
    lt_dlclose(*iter);
  m_plugin_handles.clear();

  if (m_dl_active) {
    if (lt_dlexit())
      OLA_WARN << "dlexit: " << lt_dlerror();
    m_dl_active = false;
  }
}
Exemple #25
0
/*
 * Unload all modules and clean up.
 */
int
stp_module_exit(void)
{
  /* destroy the module list (modules unloaded by callback) */
  if (module_list)
    stp_list_destroy(module_list);
  /* shut down libltdl (forces close of any unclosed modules) */
#ifdef USE_LTDL
  return lt_dlexit();
#else
  return 0;
#endif
}
Exemple #26
0
    /**
        Initializes the dynamic module facility.
        Applications that use this library must call this function
        prior to any operation involved with the facility.
        @return true on error, false otherwise.
     */
    static bool initialize()
    {
        if ( lt_dlinit() > 0 )
            return true;

        if ( lt_dlsetsearchpath("") > 0 )
        {
            lt_dlexit();
            return true;
        }

        return false;
    }
Exemple #27
0
static int
_free_loaded_module (void *item, void *data)
{
	lt_dlhandle handle = (lt_dlhandle) item;
	grad_dl_done_t fp = (grad_dl_done_t) lt_dlsym(handle, "done");

	GRAD_DEBUG2(1,"Freeing handle %p, grad_dl_done %p", handle, fp);
	if (fp)
		fp();
	lt_dlclose(handle);
	lt_dlexit();
	return 0;
}
Exemple #28
0
/* deinitialize module routines */
int neb_deinit_modules(void) {
#ifdef USE_LTDL
	int result = OK;
#endif

	/* deinitialize library */
#ifdef USE_LTDL
	result = lt_dlexit();
	if (result)
		return ERROR;
#endif

	return OK;
}
DynamicLoaderModule::~DynamicLoaderModule()
{
  // unload all loaded modules
  for ( vecDynModules::iterator it = dyn_modules.begin(); it != dyn_modules.end(); ++it )
  {
    if ( it->handle != NULL )
    {
      lt_dlclose( it->handle );
      it->handle = NULL;
    }
  }

  lt_dlexit();
}
Exemple #30
0
void *xdlopen(const char *module)
{     void *h = NULL;
      if (lt_dlinit() != 0)
      {  lib_err_msg(lt_dlerror());
         goto done;
      }
      h = lt_dlopen(module);
      if (h == NULL)
      {  lib_err_msg(lt_dlerror());
         if (lt_dlexit() != 0)
            xerror("xdlopen: %s\n", lt_dlerror());
      }
done: return h;
}