5. XploRe commands for using DLLs

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


5.1 dlopen

605 dlopen opens (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 608 setenv. Or alternatively, you can set the environment variable XPL4DLL with 611 setenv to your DLL directory before starting XploRe.

The output from 614 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.


5.2 dlcall

619 dlcall calls 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.


5.3 dlcallex

624 dlcallex calls functions from an already loaded DLL. Call the function MyFunction with

dlcallex("MyFunction", param, opt)

or

dlcallex(h, "MyFunction", param, opt)

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 argument param contains the XploRe objects (scalars, vectors, matrices, arrays) which are to be passed to the function MyFunction. The parameter opt tells how they passed to the C/C++ function. Please see section 3 for a detailled example.


5.4 dlquery

629 dlquery can 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, 632 dlquery returns a list with three components:

name name of DLL
location absolute path and name of the DLL
count how many times the DLL is opened


5.5 dlclose

637 dlclose closes (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.



Method and Data Technologies   MD*TECH Method and Data Technologies
  http://www.mdtech.de  mdtech@mdtech.de