Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

defglobalfun

defglobalfun( 
s_funcName 
( l_formalArglist ) 
g_expr1 ... 
)
=> s_funcName

Description

Defines a global function with the name and formal argument list you specify.

The functions that you define using defglobalfun are defined within a lexical scope, but are globally accessible.

For defglobalfun there must be white space between s_funcName and the open parenthesis. Expressions within the function can reference any variable on the formal argument list or any global variable defined outside the function. If necessary, local variables can be declared using the let function.

Arguments

s_funcName

Name of the function you are defining.

l_formalArglist

Formal argument list.

g_expr1

Expression or expressions to be evaluated when s_funcName is called.

Value Returned

s_funcName

The name of the function being defined.

Examples

Define two global functions, test_set and test_get using defglobalfun and  that reference a lexical variable secret_val:

toplevel 'ils
ILS-<2> (let ((secret_val 1))
(defglobalfun test_set (x) secret_val = x)
(globalProc test_get() secret_val)
)
ILS-<2> test_get()
=> 1
ILS-<2> test_set(2)
=> 2

ILS-<2> test_get()
=> 2

Related Topics

Function and Program Structure


Return to top
 ⠀
X