From RTSC-Pedia
[printable version] [offline version] | offline version generated on 11-Jun-2009 18:06 UTC |
XDCscript - xdc.useModule
Specify that a module is used in a configuration
Contents |
Synopsis
| var moduleObject = xdc.useModule(moduleName); |
Parameters
- moduleName
- the fully qualified module name of the module to be loaded; e.g., "xdc.runtime.Memory".
Description
xdc.useModule() loads the specified module and marks it as being "used on the target"; i.e., this module is directly referenced by the embedded application and, if it contains a "startup" function, this function must be called as part of the application's bootstrap.
Return Value
xdc.useModule() returns a module object or throws an exception if the module can not be found.
Throws
This method may throw an xdc.services.global.XDCException exception with one of the following ids:
- "xdc.PACKAGE_NOT_FOUND" - in the event that the specified package can not be found or its IDL files have not been compiled.
- "xdc.MODULE_NOT_FOUND" - in the event that the module can not be found in the specified package.
Examples
To include the xdc.runtime.Log module in an application, the following statement should be added to the application's configuration script.
| var Log = xdc.useModule("xdc.runtime.Log"); |
To avoid using an explicit package name when naming a module in the current package, you can use the xdc.om.$curpkg built-in variable to reference the current package object.
| var MyMod= xdc.useModule(xdc.om.$curpkg.$name + ".MyMod"); |
See also
XDCscript - Module-Body.module$use | Use other modules required by this module |
Creating Configurable Content | How to leverage the configuration process |
[printable version] [offline version] | offline version generated on 11-Jun-2009 18:06 UTC |