Example #1
0
  void PlugIn::release_library()
  {
    try
    {
      if ( m_libraryHandle != NULL )
      {
        Symbol sym = this->find_symbol(kOnUnLoadSymbol);

        OnUnLoadFunc_t unload_func = (OnUnLoadFunc_t)(sym);
        unload_func();

        this->do_release_library();
        m_libraryHandle = NULL;
      }
    }
    catch(yat::Exception& ex)
    {
      RETHROW_YAT_ERROR(ex,
                        "SHAREDLIBRARY_ERROR",
                        "Error while releasing library",
                        "PlugIn::release_library");
    }
    catch (...)
    {
      THROW_YAT_ERROR("SHAREDLIBRARY_ERROR",
                      "Unknown error while releasing library",
                      "PlugIn::release_library");
    }
  }
void sieve_plugins_unload(struct sieve_instance *svinst)
{
	struct sieve_plugin *plugin;

	if ( svinst->plugins == NULL )
		return;

	/* Call plugin unload functions for this instance */

	plugin = svinst->plugins;
	while ( plugin != NULL ) {
		struct module *module = plugin->module;
		sieve_plugin_unload_func_t unload_func;

		unload_func = (sieve_plugin_unload_func_t)module_get_symbol
			(module, t_strdup_printf("%s_unload", module->name));
		if ( unload_func != NULL ) {
			unload_func(svinst, plugin->context);
		}

		plugin = plugin->next;
	}

	/* Physically unload modules */

	i_assert(sieve_modules_refcount > 0);

	if ( --sieve_modules_refcount != 0 )
		return;

	module_dir_unload(&sieve_modules);
}