Exemple #1
0
void moPostPlugin::Load(moText plugin_file)
{
    name = plugin_file;
    handle = moLoadPlugin(plugin_file);

    if(!handle) {
    #ifndef MO_WIN32
          moDebugManager::Error( "moPostPlugin::Load > Cannot open library: " + moText(dlerror()) );
    #else
      CHAR szBuf[80];
      DWORD dw = GetLastError();
      sprintf(szBuf, "%s failed: GetLastError returned %i\n",
        (char*)plugin_file, (int)dw);
      moDebugManager::Error( "moPostPlugin::Load > Cannot open library: " + moText(szBuf) );
    #endif
      return;
    }

    #ifdef MO_WIN32
	FARPROC farp;
	farp = GetProcAddress(handle, "DestroyPostEffectFactory");
    CreatePostEffectFactory = CreatePostEffectFactoryFunction(GetProcAddress(handle, "CreatePostEffectFactory"));
	DestroyPostEffectFactory = DestroyPostEffectFactoryFunction(GetProcAddress(handle, "DestroyPostEffectFactory"));
    #else
    CreatePostEffectFactory = CreatePostEffectFactoryFunction(dlsym(handle, "CreatePostEffectFactory"));
	DestroyPostEffectFactory = DestroyPostEffectFactoryFunction(dlsym(handle, "DestroyPostEffectFactory"));
    #endif

	if(this->CreatePostEffectFactory!=NULL)
		m_factory = this->CreatePostEffectFactory();

}
void moPrePlugin::Load(moText plugin_file)
{

    name = plugin_file;
    handle = moLoadPlugin(plugin_file);

    if(!handle) {
	#if !defined(WIN32)
        cerr << "Cannot open library: " << dlerror() << '\n';
	#else
		CHAR szBuf[80];
		DWORD dw = GetLastError();
		sprintf(szBuf, "%s failed: GetLastError returned %u\n",
			(char*)plugin_file, dw);
		//MessageBox(NULL, szBuf, "Error", MB_OK);

		cerr << "Cannot open library: " << szBuf <<'\n';
	#endif
    }

    #if defined(_WIN32)
	FARPROC farp;
	farp = GetProcAddress(handle, "DestroyPreEffectFactory");
    CreatePreEffectFactory = CreatePreEffectFactoryFunction(GetProcAddress(handle, "CreatePreEffectFactory"));
	DestroyPreEffectFactory = DestroyPreEffectFactoryFunction(GetProcAddress(handle, "DestroyPreEffectFactory"));
    #else
    CreatePreEffectFactory = CreatePreEffectFactoryFunction(dlsym(handle, "CreatePreEffectFactory"));
	DestroyPreEffectFactory = DestroyPreEffectFactoryFunction(dlsym(handle, "DestroyPreEffectFactory"));
    #endif

	if(this->CreatePreEffectFactory!=NULL)
		m_factory = this->CreatePreEffectFactory();

}