## `module::new` -- loads a module

#### Introduction

`module(name)` loads a dynamic module and creates a corresponding module domain. `module(name,fname)` creates a module function environment.

#### Call(s)

`module::new(name)`
`module::new(name, fname)`
`module(name)` `module(name, fname)`

#### Parameters

`name` | - | module name: character string or identifier
`fname` | - | function name: character string or identifier

#### Returns

either a module domain of type `DOM_DOMAIN` or a function environment of type `DOM_FUNC_ENV`.

#### Side Effects

If `module::new``(name)` successfully loads a dynamic module, it creates a corresponding module domain and assigns it to the identifier `name`.

#### Related Functions

`external`, `loadmod`, `module::age`, `module::displace`, `module::max`, `module::stat`, `module::which`, `unloadmod`

#### Details

- `module::new``(name)` uses the function `module::load` to load a module.
- `module::new``(name,fname)` uses the function `module::func` to create a module function environment.

#### Example 1

This example loads a dynamic module. Since a module is represented as a `domain`, it can be used in the same way as library packages or other MuPAD domains. Module online documentation can be displayed with the library function `module::help`.

    >> module("stdmod")

                                      stdmod

    >> stdmod::which("stdmod")

          "/usr/local/mupad/linux/modules/stdmod.mdm"

    >> type(stdmod); info(stdmod)

                                    DOM_DOMAIN

          Module: 'stdmod' created on 16.Oct.00 by mmg R-2.0.0
          Module: Extended Module Management
          - Interface:
          stdmod::age,  stdmod::doc,   stdmod::help, stdmod::max,
          stdmod::stat, stdmod::which

    >> export(stdmod): which("stdmod")

          Warning: 'max' already has a value, not exported.
          Warning: 'help' already has a value, not exported.

          "/usr/local/mupad/linux/modules/stdmod.mdm"

#### Example 2

Module function environments can be stored in local or global variables and used to execute module functions without loading the module explicitly. The corresponding machine code is loaded on demand when the module function is executed.

    >> where := module("stdmod","which"):
       where("stdmod")

          "/usr/local/mupad/linux/modules/stdmod.mdm"

#### Background

- More detailed information are available with the kernel functions `loadmod`, `unloadmod` and `external`.
- Module online documentation can be displayed with the library function `module::help`.
- Reference: Dynamic Modules - User's Manual and Programming Guide for MuPAD 1.4, Andreas Sorgatz, Oct 1998, Springer Verlag, Heidelberg, with CD-ROM, ISBN 3-540-65043-1.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000