コード例 #1
0
ファイル: plugin.cpp プロジェクト: bakkdoor/mineserver
void Plugin::unloadExternal(const std::string name)
{
    LIBRARY_HANDLE lhandle = NULL;
    void (*fhandle)(Mineserver*) = NULL;

    if (m_libraryHandles[name] != NULL)
    {
        Mineserver::get()->screen()->log("Unloading plugin "+name+"...");

        lhandle = m_libraryHandles[name];
        fhandle = (void (*)(Mineserver*)) LIBRARY_SYMBOL(lhandle, (name+"_shutdown").c_str());
        if (fhandle == NULL)
        {
            Mineserver::get()->screen()->log("Could not get shutdown function handle!");
        }
        else
        {
            Mineserver::get()->screen()->log("Calling shutdown function for "+name+".");
            fhandle(Mineserver::get());
        }

        LIBRARY_CLOSE(m_libraryHandles[name]);
        m_libraryHandles.erase(name);
    }
    else
    {
        Mineserver::get()->screen()->log("Plugin "+name+" not loaded!");
    }
}
コード例 #2
0
ファイル: plugin.cpp プロジェクト: bluepeppers/mineserver
void Plugin::unloadPlugin(const std::string name)
{
  LIBRARY_HANDLE lhandle = NULL;
#ifdef FADOR_PLUGIN
  void (*fhandle)(void) = NULL;
#else
  void (*fhandle)(Mineserver*) = NULL;
#endif

  if (m_pluginVersions.find(name) != m_pluginVersions.end())
  {
    LOG(INFO, "Plugin", "Unloading plugin `"+name+"'...");

    if (m_libraryHandles[name] != NULL)
    {
      lhandle = m_libraryHandles[name];
      m_libraryHandles.erase(name);
    }
    else
    {
      lhandle = LIBRARY_SELF();
    }

#ifdef FADOR_PLUGIN
    fhandle = (void (*)(void)) LIBRARY_SYMBOL(lhandle, (name+"_shutdown").c_str());
#else
    fhandle = (void (*)(Mineserver*)) LIBRARY_SYMBOL(lhandle, (name+"_shutdown").c_str());
#endif

    if (fhandle == NULL)
    {
      LOG(INFO, "Plugin","Could not get shutdown function handle!");
    }
    else
    {
      LOG(INFO, "Plugin","Calling shutdown function for `"+name+"'.");
      
#ifdef FADOR_PLUGIN  
      fhandle();
#else
      fhandle(Mineserver::get());
#endif
    }

    LIBRARY_CLOSE(m_libraryHandles[name]);
  }
  else
  {
    LOG(INFO, "Plugin", "Plugin `"+name+"' not loaded!");
  }
}
コード例 #3
0
ファイル: lib_loader.c プロジェクト: nowl/semblis
void ll_destroy(LibLoader *lib)
{
    unsigned int i;

    /* close all the libraries */
    for(i=0; i<loaded_libs_size; i++) {
        LIBRARY_HANDLE handle = loaded_libs[i];
        LIBRARY_CLOSE(handle);            
    }
	
    free(loaded_libs);
    
    free(lib);
}
コード例 #4
0
ファイル: plugin.cpp プロジェクト: Almamu/mineserver
void Plugin::unloadPlugin(const std::string& name)
{
  LIBRARY_HANDLE lhandle = NULL;
  pfv fhandle = NULL;

  if (m_pluginVersions.find(name) != m_pluginVersions.end())
  {
    LOG(INFO, "Plugin", "Unloading: " + name);

    if (m_libraryHandles[name] != NULL)
    {
      lhandle = m_libraryHandles[name];
      m_libraryHandles.erase(name);
    }
    else
    {
      lhandle = LIBRARY_SELF();
    }

    *reinterpret_cast<void**>(&fhandle) = (void*)LIBRARY_SYMBOL(lhandle, (name + "_shutdown").c_str());
    if (fhandle == NULL)
    {
      LOG(INFO, "Plugin", "Could not get shutdown function handle!");
    }
    else
    {
      LOG(INFO, "Plugin", "Calling shutdown function for: " + name);
      fhandle();
    }

    LIBRARY_CLOSE(m_libraryHandles[name]);
  }
  else
  {
    LOG(WARNING, "Plugin", name + " is not loaded!");
  }
}
コード例 #5
0
ファイル: Plugin.cpp プロジェクト: johnbellone/gtkworkbook
Plugin::~Plugin (void) {
	// If this comment is still here then this potentially really, really, bad idea turned
	// out to actually work. There is probably a much better and safer way to do this.
	LIBRARY_CLOSE (platform->handle);
	delete platform;
}