XDCscript - xdc.useModule

From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 17-Jul-2018 11:07 UTC

XDCscript - xdc.useModule

Specify that a module is used in a configuration



var moduleObject = xdc.useModule(moduleName);


the fully qualified module name of the module to be loaded; e.g., "xdc.runtime.Memory".


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 cannot be found.


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 cannot be found or its IDL files have not been compiled.
  • "xdc.MODULE_NOT_FOUND" - in the event that the module cannot be found in the specified package.


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 17-Jul-2018 11:07 UTC
Copyright © 2008 The Eclipse Foundation. All Rights Reserved
Personal tools
package reference