$UserFunction

Invokes a special function built by the user.

Syntax

$userfunction(expression-1, expression-2, ...)

Parameters

expression-1

Any value, or an expression that yields any value.

expression-2

Any value, or an expression that yields any value.

Return Value

The return value is determined by the type and length of expression-1.

Comments for Windows Environments

On Windows environments, the user function is a DLL whose name is assumed to be "#z32func.dll" (it can be defined as any other name) where the symbol "#" denotes the directory where the environment variable ZIM points to (that is where is Zim is installed). You may modify it by setting the environment variable ZIMFUNC in the Registry to point to another location or to another name like this example:

ZIMFUNC     c:\program files\zim\8.50\myfunc.dll

The DLL is loaded the first time the $UserFunction is invoked by a Zim command.

Comments for UNIX Environments

The name of the user function for UNIX environments is assumed to be "#zimfunc" where the symbol "#" denotes the directory where the environment variable ZIM points to (that is where is Zim is installed). You may modify it by setting the environment variable ZIMFUNC in the Registry to point to another location or to another name like this example:

ZIMFUNC=/usr/zim/zimfunc
export ZIMFUNC

The "zimfunc" executable is loaded once the first time the $UserFunction is invoked by a Zim command.

 

6. the length of the tUserBuf structure, this may or may not be used

7. ensure that you are using 1 byte packing (or /Zp1 on the compile line)

The example program, zfuncwin.c, displays information in a MessageBox

about the arguments that are passed to it from ZIM and returns the

first argument as the result.

To test this example try entering Zim:

list 5 docs format $userfunction (docname, filename)

or

out $userfunction ("hi there")