autoload_undefined_symbol

Gamma: Version 4.0
Prev |  | Next

# `autoload_undefined_symbol`

`autoload_undefined_symbol` -- checks undefined symbols for `AutoLoad`.

## Syntax

    autoload_undefined_symbol (!sym)

## Arguments

`sym`

  A symbol.

## Returns

`nil` on success, else error.

## Description

This function is generally used internally by the `AutoLoadLib.g` program. It is the default function that is called when an undefined symbol is encountered at run-time, if the `AutoLoad.g` library has been required into the program. This is normally done by startup.g, which is automatically loaded by the Gamma executable at startup.

## Example

In this example, the first symbol (`test1`) is checked by `autoload_undefined_symbol` from within the `AutoLoadLib.g` program. We know this because the message "`Looking for `symbol``" indicates that Gamma had to use `AutoLoadLib.g` to get the definition of the symbol. For the second symbol (`test2`), we make the `autoload_undefined_symbol` call ourselves, and the "`Looking for `symbol``" doesn't appear. This indicates that Gamma knew the value of the symbol and didn't have to use `AutoLoadLib.g` to look it up.

        Gamma> AutoLoad("test1", `test1 = 9);
        (("test1" setq test1 9) ("P[Tthg]*" DllLoad "libgammaph.so")...)
        Gamma> test1;
        Looking for test1
        9
        Gamma> AutoLoad("test2", `test2 = 8);
        (("test2" setq test2 8) ("test1" setq test1 9) ("P[Tthg]*" DllLoad "libgammaph.so")...)
        Gamma> autoload_undefined_symbol(test2);
        nil
        Gamma> test2;
        8
        Gamma>

## See Also

`AutoLoad`

Prev | Home | Next
`AutoLoad` | Up | `AutoMapFunction`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.