All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 Functions

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 Functions

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 QoreHashNode * | getModuleHash ()
| retuns a hash of module information hashes, caller owns the list reference returned
static DLLEXPORT QoreListNode * | getModuleList ()
| retuns a list of module information hashes, caller owns the list reference returned
static DLLEXPORT QoreStringNode * | parseLoadModule (const char *name, QoreProgram *pgm=0)
| 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...

## 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

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

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

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

  dir | the directory path to add to the list

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

  strlist | a list of directories separated by ':' characters to add to the QORE_MODULE_DIR list

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

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

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

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

  name | can be either a feature name or the full path to the module file
  xsink | if 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

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

  name | can be either a feature name or the full path to the module file
  pgm | the QoreProgram object in which to include all module additions (namespaces, classes, constants, etc) immediately
  xsink | if 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

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

- include/qore/ModuleManager.h (6de6cc3b438610bf03b2bec44a3d7c61f90e3165)