/* === S Y N F I G ========================================================= */
-/*! \file module.cpp
+/*! \file synfig/module.cpp
** \brief writeme
**
-** $Id: module.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
+** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
#include "module.h"
#include "general.h"
-#include <ltdl.h>
#include <ETL/stringf>
+
+#ifndef USE_CF_BUNDLES
+#include <ltdl.h>
+#endif
+
#endif
/* === M A C R O S ========================================================= */
bool
Module::subsys_init(const String &prefix)
{
+#ifndef USE_CF_BUNDLES
#ifndef SYNFIG_LTDL_NO_STATIC
//LTDL_SET_PRELOADED_SYMBOLS();
#endif
-
+
if(lt_dlinit())
{
error(_("Errors on lt_dlinit()"));
#endif
lt_dladdsearchdir("/usr/local/lib/synfig/modules");
lt_dladdsearchdir(".");
-
+#endif
book_=new Book;
return true;
}
Module::subsys_stop()
{
delete book_;
-
+
+#ifndef USE_CF_BUNDLES
lt_dlexit();
+#endif
return true;
}
bool
synfig::Module::Register(const String &module_name, ProgressCallback *callback)
{
+#ifndef USE_CF_BUNDLES
lt_dlhandle module;
if(callback)callback->task(strprintf(_("Attempting to register \"%s\""),module_name.c_str()));
module=lt_dlopenext((string("lib")+module_name).c_str());
if(!module)module=lt_dlopenext(module_name.c_str());
-
+
if(!module)
{
if(callback)callback->warning(strprintf(_("Unable to find module \"%s\" (%s)"),module_name.c_str(),lt_dlerror()));
}
if(callback)callback->task(strprintf(_("Found module \"%s\""),module_name.c_str()));
-
+
Module::constructor_type constructor=NULL;
Handle mod;
// if(callback)callback->task(string("looking for -> lib")+module_name+"_LTX_new_instance()");
constructor=(Module::constructor_type )lt_dlsym(module,(string("_")+module_name+"_LTX_new_instance").c_str());
}
-
+
if(constructor)
{
// if(callback)callback->task(strprintf("Executing callback for \"%s\"",module_name.c_str()));
}
if(callback)callback->task(strprintf(_("Success for \"%s\""),module_name.c_str()));
-
+
+#endif
return false;
}