Super Prev Next

Usage scheme

xFunction consists of a set of classes providing all required functionality for data type representation and calls of external functions. The following words emphasized in this text have a special meaning:

structure - an instance of a com.excelsior.xFunction.Structure subclass

callback - an instance of a com.excelsior.xFunction.Callback subclass

argument - an instance of the com.excelsior.xFunction.Argument class

pointer - an instance of the com.excelsior.xFunction.Pointer class

In the rest of this document, the xFunction package classes Argument, Structure, Pointer and Callback are mentioned without the package name.

The common scheme of the xFunction usage looks as follows:

  1. Define data types of external function arguments. Specifically, if an external function receives or returns structures or callbacks, the abstract classes Structure and Callback should be implemented to reflect the required entities. Note that this step may be omitted if the external function being invoked have only primitive type or string parameters.
  2. Create arguments. Input arguments should be created with proper initial values.
  3. Create an instance of the xFunction class for each external function that you need to call.
  4. Call the proper xFunction.invoke instance method. Given argument(s) (if any), it formally returns java.lang.Object, which is actually an instance of a primitive type wrapping class, an instance of java.lang.String, structure, or pointer, so the return value may then be used in your Java program.

    If the external function has output parameters returned by reference, invoke changes the respective arguments appropriately before returning. Values of those arguments may be obtained later by Argument class’ methods.