There are many examples of external functions interfaced with Scilab in
the directories SCIDIR/examples/interface-tour and SCIDIR/examples/interface-tour-so.
Examples are given in C and Fortran.
The best way to build an interface is to copy one of the examples
given there and to adapt the code to particular needs.