S-Lang Run-Time Library Reference: Version 2.0.4: Module Functions

Next Previous Contents

## 19. Module Functions

## 19.1 get_import_module_path

Synopsis

  Get the search path for dynamically loadable objects

Usage

  `String_Type get_import_module_path ()`

Description

  The `get_import_module_path` may be used to get the search path for dynamically shared objects. Such objects may be made accessible to the application via the `import` function.

See Also

  `import, set_import_module_path`

## 19.2 import

Synopsis

  Dynamically link to a specified module

Usage

  `import (String_Type module [, String_Type namespace])`

Description

  The `import` function causes the run-time linker to dynamically link to the shared object specified by the `module` parameter. It searches for the shared object as follows: First a search is performed along all module paths specified by the application. Then a search is made along the paths defined via the `set_import_module_path` function. If not found, a search is performed along the paths given by the `SLANG_MODULE_PATH` environment variable. Finally, a system dependent search is performed (e.g., using the `LD_LIBRARY_PATH` environment variable).

  The optional second parameter may be used to specify a namespace for the intrinsic functions and variables of the module. If this parameter is not present, the intrinsic objects will be placed into the active namespace, or global namespace if the active namespace is anonymous.

  This function throws an `ImportError` if the specified module is not found.

Notes

  The `import` function is not available on all systems.

See Also

  `set_import_module_path, use_namespace, current_namespace, getenv, evalfile`

## 19.3 set_import_module_path

Synopsis

  Set the search path for dynamically loadable objects

Usage

  `set_import_module_path (String_Type path_list)`

Description

  The `set_import_module_path` may be used to set the search path for dynamically shared objects. Such objects may be made accessible to the application via the `import` function.

  The actual syntax for the specification of the set of paths will vary according to the operating system. Under Unix, a colon character is used to separate paths in `path_list`. For win32 systems a semi-colon is used. The `path_get_delimiter` function may be used to get the value of the delimiter.

See Also

  `import, get_import_module_path, path_get_delimiter`

Next Previous Contents