Qore Programming Language 1.12.4
Loading...
Searching...
No Matches
ModuleManager Class Reference

manages the loading of Qore modules from feature or path names. Also manages adding module changes into QoreProgram objects. More...

#include <ModuleManager.h>

Public Member Methods

DLLEXPORT void registerUserModuleFromSource (const char *name, const char *src, QoreProgram *pgm, ExceptionSink *xsink)
 registers the given user module from the module source given as an argument
 

Static Public Member Methods

static DLLEXPORT void addAutoModuleDir (const char *dir)
 no longer supported - removed for security reasons More...
 
static DLLEXPORT void addAutoModuleDirList (const char *strlist)
 no longer supported - removed for security reasons More...
 
static DLLEXPORT void addModuleDir (const char *dir)
 to add a single directory to the QORE_MODULE_DIR list, can only be called before the library initialization function qore_init() More...
 
static DLLEXPORT void addModuleDirList (const char *strlist)
 to add a list of directories separated by ':' characters to the QORE_MODULE_DIR list, can only be called before the library initialization function qore_init() More...
 
static DLLEXPORT void addStandardModulePaths ()
 adds the standard module directories to the module path (only necessary if the module paths are set up manually, otherwise these paths are added automatically when qore_init() is called)
 
static DLLEXPORT QoreHashNodegetModuleHash ()
 retuns a hash of module information hashes, caller owns the list reference returned
 
static DLLEXPORT QoreListNodegetModuleList ()
 retuns a list of module information hashes, caller owns the list reference returned
 
static DLLEXPORT QoreStringNodeparseLoadModule (const char *name, QoreProgram *pgm=nullptr)
 loads the named module at parse time (or before run time, even if parsing is not active), returns a non-0 QoreStringNode pointer if an error occured, caller owns the QoreStringNode pointer's reference count returned if non-0 More...
 
static DLLEXPORT int runTimeLoadModule (const char *name, ExceptionSink *xsink)
 loads the named module at run time, returns -1 if an exception was raised, 0 for OK More...
 
static DLLEXPORT int runTimeLoadModule (const char *name, QoreProgram *pgm, ExceptionSink *xsink)
 loads the named module at run time, returns -1 if an exception was raised, 0 for OK More...
 
static DLLEXPORT int runTimeLoadModule (ExceptionSink *xsink, const char *name, QoreProgram *pgm=nullptr, qore_binary_module_desc_t mod_desc_func=nullptr)
 Loads the module at runtime, returns -1 if an exception was raised, 0 for OK. More...
 

Detailed Description

manages the loading of Qore modules from feature or path names. Also manages adding module changes into QoreProgram objects.

in the case that a QoreProgram object is created before a module is loaded externally (either through another QoreProgram object or through a direct call to the appropriate ModuleManager function), if the QoreProgram object then requests the feature, the ModuleManager will load in all namespace (class, constant, etc) changes into the QoreProgram object. All members and methods are static; there will always only be one of these...

Member Function Documentation

◆ addAutoModuleDir()

static DLLEXPORT void ModuleManager::addAutoModuleDir ( const char *  dir)
static

no longer supported - removed for security reasons

this function will abort() in debug builds, does nothing in production builds

Since
qore 0.8.4 support for auto module directories was removed

◆ addAutoModuleDirList()

static DLLEXPORT void ModuleManager::addAutoModuleDirList ( const char *  strlist)
static

no longer supported - removed for security reasons

this function will abort() in debug builds, does nothing in production builds

Since
qore 0.8.4 support for auto module directories was removed

◆ addModuleDir()

static DLLEXPORT void ModuleManager::addModuleDir ( const char *  dir)
static

to add a single directory to the QORE_MODULE_DIR list, can only be called before the library initialization function qore_init()

Parameters
dirthe directory path to add to the list

◆ addModuleDirList()

static DLLEXPORT void ModuleManager::addModuleDirList ( const char *  strlist)
static

to add a list of directories separated by ':' characters to the QORE_MODULE_DIR list, can only be called before the library initialization function qore_init()

Parameters
strlista list of directories separated by ':' characters to add to the QORE_MODULE_DIR list

◆ parseLoadModule()

static DLLEXPORT QoreStringNode * ModuleManager::parseLoadModule ( const char *  name,
QoreProgram pgm = nullptr 
)
static

loads the named module at parse time (or before run time, even if parsing is not active), returns a non-0 QoreStringNode pointer if an error occured, caller owns the QoreStringNode pointer's reference count returned if non-0

if the feature is already loaded, then the function returns immediately without raising an error The feature's namespace changes are added to the QoreProgram object if the feature is loaded and the pgm argument is non-zero.

Parameters
namecan be either a feature name or the full path to the module file
pgmthe QoreProgram object in which to include all module additions (namespaces, classes, constants, etc) immediately

◆ runTimeLoadModule() [1/3]

static DLLEXPORT int ModuleManager::runTimeLoadModule ( const char *  name,
ExceptionSink xsink 
)
static

loads the named module at run time, returns -1 if an exception was raised, 0 for OK

If the feature is already loaded, then the function returns immediately without raising an error. The feature's namespace changes are added to the QoreProgram object if the feature is loaded.

Parameters
namecan be either a feature name or the full path to the module file
xsinkif any errors are encountered loading the module, then a Qore-language "LOAD-MODULE-ERROR" exception is raised here
Returns
-1 if an exception was raised, 0 for OK

◆ runTimeLoadModule() [2/3]

static DLLEXPORT int ModuleManager::runTimeLoadModule ( const char *  name,
QoreProgram pgm,
ExceptionSink xsink 
)
static

loads the named module at run time, returns -1 if an exception was raised, 0 for OK

If the feature is already loaded, then the function returns immediately without raising an error. The feature's namespace changes are added to the QoreProgram object if the feature is loaded.

Parameters
namecan be either a feature name or the full path to the module file
pgmthe QoreProgram object in which to include all module additions (namespaces, classes, constants, etc) immediately
xsinkif any errors are encountered loading the module, then a Qore-language "LOAD-MODULE-ERROR" exception is raised here
Returns
-1 if an exception was raised, 0 for OK

◆ runTimeLoadModule() [3/3]

static DLLEXPORT int ModuleManager::runTimeLoadModule ( ExceptionSink xsink,
const char *  name,
QoreProgram pgm = nullptr,
qore_binary_module_desc_t  mod_desc_func = nullptr 
)
static

Loads the module at runtime, returns -1 if an exception was raised, 0 for OK.

If the feature is already loaded, then the function loads the namespace additions into the target program, if any.

Parameters
xsinkif any errors are encountered loading the module, then a Qore-language "LOAD-MODULE-ERROR" exception is raised here
namecan be either a feature name or the full path to the module file
pgmthe QoreProgram object in which to include all module additions (namespaces, classes, constants, etc) immediately
mod_desc_functhe module description function; this is for cases when an existing binary code registers a Qore module at runtime; this argument is only used if the module to be loaded is a binary module that has not yet been loaded, otherwise it is ignored
Since
Qore 0.9.5

The documentation for this class was generated from the following file: