6.2.3 Functions used for building an interface

The functions used to build an interface are Fortran subroutines when the interface is written in Fortran and are coded as C macros (defined in stack-c.h ) when the interface is coded in C. The main functions are as follows:

Once the variables have been processed by GetRhsVar or created by CreateVar, they are given values by calling one or several numerical routine. The call to the numerical routine is done in such a way that each argument of the routine points to the corresponding Scilab variable. Character, integer, real, double and double complex type variables are respectively in the cstk, istk, sstk, stk, zstk Scilab internal stack at the adresses lk's returned by GetRhsVar or CreateVar.

Then they are returned to Scilab as lhs variables. The interface should define how the lhs (output) variables are numbered. This is done by the global variable LhsVar. For instance

  LhsVar(1) = 5;
  LhsVar(2) = 3;
  LhsVar(3) = 1;
  LhsVar(4) = 2;
means that the Scilab function has at most 4 output parameters which are variables numbered k= 5, k=3, k=1, k=2 respectively.

The functions sciprint(amessage) and Error(k) are used for managing messages and errors.

Other useful functions which can be used are the following.

The Fortran functions have the same syntax and return logical values.