next up previous contents index
Next: 6.1.2 Calling a dynamically Up: 6.1 Using dynamic link Previous: 6.1 Using dynamic link

   
6.1.1 Dynamic link

The command link('path/pgm.o','pgm',flag) links the compiled program pgm to Scilab. Here pgm.o is an object file located in the path directory and pgm is an entry point (program name) in the file pgm.o (An object file can have several entry points: to link them, use a vector of character strings such as ['pgm1','pgm2']).

flag should be set to 'C' for a C-coded program and to 'F' for a Fortran subroutine. ('F' is the default flag and can be omitted).

If the link operation is OK, scilab returns an integer n associated with this linked program. To undo the link enter ulink(n).

The command c_link('pgm') returns true if pgm is currently linked to Scilab and false if not.

Here is a example, with the Fortran BLAS daxpy subroutine used in Scilab:

-->n=link(SCI+'/routines/calelm/daxpy.o','daxpy')
linking files /usr/local/lib/scilab-2.4/routines/calelm/daxpy.o
to create a shared executable.
Linking daxpy (in fact daxpy_)
Link done
 n  =
 
    0.  
 
-->c_link('daxpy')
 ans  =
 
  T  

-->ulink(n)
 
-->c_link('daxpy')
 ans  =
 
  F

For more details, enter help link.


next up previous contents index
Next: 6.1.2 Calling a dynamically Up: 6.1 Using dynamic link Previous: 6.1 Using dynamic link
Scilab Group