Subsections


6. XploRe commands for using DLLs

Xplore has four commands which are to be used with DLLs:


6.1 dlopen

xpl_3.gif dlopenpens (loads) a DLL. Call the DLL named MyDLL with

h = dlopen("MyDLL")

or

h = dlopen("absolute_path_to_MyDLL")

In the first call, you need to have set the path to your DLL by xpl_3.gif setenv Or alternatively, you can set the environment variable XPL4DLL with xpl_3.gif setenvo your DLL directory before starting XploRe.

The output from xpl_3.gif dlopen the scalar h, is the handle of the opened DLL. Each time you open a DLL, this handle is incremented by 1. The handle is used to distinguish between two opened DLLs with the same name.


6.2 dlcall

xpl_3.gif dlcallalls functions from an already loaded DLL. Call the function MyFunction with

dlcall("MyFunction", arg1, arg2, ...)

or

dlcall(h, "MyFunction", arg1, arg2, ...)

The second call applies, when you want to call explicitely the function MyFunction, which belongs to the DLL with handle h. You can omit the handle, if there is only one MyFunction in all the opened DLLs.

The arguments arg1, arg2, ... are the XploRe objects (scalars, vectors, matrices, arrays) which are to be passed to the function MyFunction.


6.3 dlquery

xpl_3.gif dlqueryan be used to find out which DLLs are opened. It is invoked with

q = dlquery()

In case, that no DLL is open, it simply gives the value 0. In the case, that one or more DLLs are open, xpl_3.gif dlqueryeturns a list with three components:

n number of opened DLLs
handle handle of the DLL
name name of the DLL


6.4 dlclose

xpl_3.gif dlcloseloses (unloads) one or all DLLs. It is called by

dlclose("MyDLL")

or

dlclose(h)

or

dlclose()

The first and second call close a specified DLL by its name or by its handle, respectively. The last call will close all open DLLs.