- Справка Scilab
- Dynamic/incremental Link
- Supported and compatible compilers
Fortran or C user routines call
// long form 'out' is present [y1,...,yk] = fort("ident",x1,px1,"tx1",...,xn,pxn,"txn","out",[ny1,my1],py1,"ty1",...,[nyl,myl],pyl,"tyl") // short form : no 'out' parameter [y1,....,yk] = fort("ident",x1,...,xn)
real matrix or string
- pxi, pyi
- txi, tyi
Interactive call of Fortran (or C) user program from Scilab. The routine must be previously linked with Scilab. This link may be done:
with Scilab "
link" command (dynamic link) during the Scilab session.(see
There are two forms of calling syntax, a short one and a long one. The short one will give faster code and an easier calling syntax but one has to write a small (C or Fortran) interface in order to make the short form possible. The long one make it possible to call a Fortran routine (or a C one) without modification of the code but the syntax is more complex and the interpreted code slower.
The meaning of each parameter is described now:
is the name of the called subroutine.
are input variables (real matrices or strings) sent to the routine,
are the respective positions of these variables in the calling sequence of the routine
are their types (
"c"for real (float) , integer, double precision and strings)
is a keyword used to separate input variables from output variables. when this key word is present it is assumed that the long form will be used and when it is not present, the short form is used.
- [ny1, my1]
are the size (number of rows and columns. For 'c' arguments,
m1*n1is the number of characters ) of output variables and
- py1, ...
are the positions of output variables (possibly equal to
pxi) in the syntax of the routine. The
pyi's integers must be in increasing order.
- "ty1", ...
are the Fortran types of output variables. The
kfirst output variables are put in
If an output variable coincides with an input variable (i.e.
pyi=pxj ) one can pass only its position
pyi . The size and type of
then the same as those of
xi. If an output variable
coincides with an input variable and one specify the dimensions of the
[myl,nyl] must follow the compatibility
mxk*nxk >= myl*nyl.
For example the following program:
link("foof"+getdynlibext(),"foof") a=[1,2,3;4,5,6];b= %pi; [m,n]=size(a); // Inputs: // a is in position 2 and double // b 3 double // n 4 integer // m 5 integer // Outputs: // c is in position 1 and double with size [m,n] c=fort("foof",a,2,"d",b,3,"d",n,4,"i",m,5,"i","out",[m,n],1,"d");
returns the matrix
The same example coded in C: