BeBOP Optimized Sparse Kernel Interface Library  1.0.1h
Typedefs | Functions
modloader.h File Reference

Shared library module loader. More...

#include <libltdl/ltdl.h>

Go to the source code of this file.

Typedefs

typedef lt_dlhandle oski_modhandle_t
 Handle to a shared library module.
typedef oski_id_t(* oski_register_funcpt )(const char *, oski_id_t, oski_id_t)
 Module registration routine.

Functions

int oski_InitModuleLoader (void)
 Initialize the dynamic/shared library loader.
void oski_CloseModuleLoader (void)
 Shutdown the dynamic/shared library loader.
oski_modhandle_t oski_LoadModule (const char *name)
 Load a library module.
oski_modhandle_t oski_LoadModuleOptional (const char *name)
 Load a library module, but do not call the error handler if the module does not exist.
void oski_CallModuleInit (oski_modhandle_t module)
 Execute a loaded module's initialization code, if any.
void oski_CloseModule (oski_modhandle_t module)
 Execute a loaded module's shutdown code, if any.
int oski_UnloadModule (oski_modhandle_t module)
 Unload a library module.
void * oski_LookupModuleMethod (const oski_modhandle_t module, const char *method_name)
 Find a routine within a shared library module.
char * oski_MakeModuleDesc (const char *name, oski_id_t ind, oski_id_t val)
 Returns a newly allocated NULL-terminated string describing the matrix type, used primarily for debugging purposes.
char * oski_MakeModuleName (const char *mod_type_name, const char *name, oski_id_t ind, oski_id_t val)
 Returns a newly allocated NULL-terminated string specifying the shared library module name for the indicated matrix type.
int oski_RegisterSiteModules (const char *file, const char *mod_type_name, oski_register_funcpt func)
 Load site modules.

Detailed Description

Shared library module loader.

To prevent our users' dependence on our use of libltdl this file must be explicitly included by a source file when needed.


Function Documentation

int oski_InitModuleLoader ( void  )

Initialize the dynamic/shared library loader.

Returns:
1 on success, 0 on error.
Postcondition:
The module loader routines to load modules and lookup functions may be called after this routine returns 1.

References ERR_INIT_SHAREDLIB, oski_HandleError, oski_InitModuleLoader(), and oski_PrintDebugMessage().

Referenced by oski_Init(), and oski_InitModuleLoader().

oski_modhandle_t oski_LoadModule ( const char *  modname)

Load a library module.

Parameters:
[in]modnameName of shared library module to load.
Returns:
A handle to the loaded module, or NULL on error.

References ERR_LOAD_MOD, oski_HandleError, oski_LoadModule(), and oski_LoadModuleOptional().

Referenced by BCSR_GetKernel(), MBCSR_GetSubmatKernel(), and oski_LoadModule().

oski_modhandle_t oski_LoadModuleOptional ( const char *  modname)

Load a library module, but do not call the error handler if the module does not exist.

Parameters:
[in]modnameName of shared library module to load.
Returns:
A handle to the loaded module, or NULL on error.

References oski_CallModuleInit(), oski_LoadModuleOptional(), and oski_PrintDebugMessage().

Referenced by oski_LoadModule(), oski_LoadModuleOptional(), oski_RegisterHeur(), and oski_RegisterMatType().

void* oski_LookupModuleMethod ( const oski_modhandle_t  module,
const char *  method_name 
)

Find a routine within a shared library module.

Find a routine within a shared library module.

Parameters:
[in]moduleModule pointer.
[in]method_nameName of the method (routine) to find.
Returns:
A pointer to the routine, or NULL if not found.

References oski_LookupModuleMethod().

Referenced by BCSR_GetKernel(), MBCSR_GetSubmatKernel(), oski_LookupHeurIdMethod(), oski_LookupMatTypeIdMethod(), and oski_LookupModuleMethod().

char* oski_MakeModuleDesc ( const char *  name,
oski_id_t  ind,
oski_id_t  val 
)

Returns a newly allocated NULL-terminated string describing the matrix type, used primarily for debugging purposes.

Returns a newly allocated NULL-terminated string describing the matrix type, used primarily for debugging purposes.

Returns:
NULL on error.

References oski_GetScalarIndexName(), oski_GetScalarValueName(), oski_MakeModuleDesc(), and oski_StringPrintf().

Referenced by oski_MakeModuleDesc(), oski_RegisterHeur(), and oski_RegisterMatType().

char* oski_MakeModuleName ( const char *  mod_type_name,
const char *  name,
oski_id_t  ind,
oski_id_t  val 
)

Returns a newly allocated NULL-terminated string specifying the shared library module name for the indicated matrix type.

Returns a newly allocated NULL-terminated string specifying the shared library module name for the indicated matrix type.

Returns:
NULL on error.

References oski_GetScalarIndexTag(), oski_GetScalarValueTag(), oski_MakeModuleName(), and oski_StringPrintf().

Referenced by oski_CreateMatReprFromCSR(), oski_MakeModuleName(), oski_RegisterHeur(), oski_RegisterMatType(), and SetModuleName().

int oski_RegisterSiteModules ( const char *  filebase,
const char *  mod_type_name,
oski_register_funcpt  func 
)

Load site modules.

Returns:
0 on error, or a non-zero value.

References oski_PrintDebugMessage(), and oski_RegisterSiteModules().

Referenced by oski_RegisterSiteModules().

Unload a library module.

Returns:
1 if module was unloaded successfully or module == NULL, and 0 otherwise.

References ERR_UNLOAD_MOD, oski_HandleError, oski_PrintDebugMessage(), and oski_UnloadModule().

Referenced by oski_UnloadModule().