/*
 * The Spar Library - modular math parser
 * Copyright (C) 2000,2001 Davide Angelocola <davide178@inwind.it>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 *
 */

/**
 *  file module_loader.h
 *  brief Modules loader extern interface.
*/

#ifndef _sl_module_loader_h
#define _sl_module_loader_h

#include <spar/sl_conf.h>

__BEGIN_DECLS
/**
 *  Loads a all modules from a modules configuration file
 *
 *  This simple function open a modules configuration file (read only mode)
 *  and run the sl_module_load() function to loads all modules into the 
 *  modules binary tree. 
 */
int sl_module_loader_load_config (const char *filename);

/**
 *  Loads a module 
 *
 *  This function is quiet complicated. It uses the dl interface to load 
 *  a module (that is a dynamic library .so): if there are any error the 
 *  dlerror function is called, reporting a detailed message of the error.
 *
 *  If a module is opened correctly, the function get_module, retrieve the
 *  module struct and do some extra checks (m->name == NULL), and, finally 
 *  the module is loaded in memory by calling @module_management_add_module()
 */
int sl_module_loader_load (const char *filename);

/**
 *  Inits the module loader
 *
 *  Simply: 
 *     sl_module_management_init ();    -> inits the module binary tree
 *     __module_ID_counter = 0; 	     -> inits the modules counter	
 */
void sl_module_loader_init (void);

__END_DECLS
#endif /* _sl_module_loader_h */


syntax highlighted by Code2HTML, v. 0.9.1