613-518-1166 info@zimdatabases.com

ZIM Language Reference

$UserFunction

< All Topics

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 fileszim8.50myfunc.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”)

 

 

 

 

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents