Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Português - 日本語

Please note that the recommended version of Scilab is 6.0.2. This page might be outdated.
However, this page did not exist in the previous stable version.

Manuel Scilab >> API Scilab > Scilab Gateway API > OverLoad


C gateway function which tells Scilab to look for another overloaded function

Calling Sequence




the position in the Scilab memory of the parameter for which we want to take into account for the overloading process (input argument)


A C gateway function which tells Scilab to look for another overloaded function. Scilab then appends to the name of the function a prefix (like %sp_ if the parameter taken into account is sparse) and look for the overloaded function. You must include stack-c.h to benefit from this function.

Be careful with the Scilab name of the function. Indeed, the current overloading process of Scilab works only on Scilab primitives (Scilab function wrote in C) which must have a Scilab name which is maximum 8 char wide.

WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use API Scilab (the new Scilab API).


In this example, the C interface function takes one input parameters and prints the integer corresponding to the type of the variable sent as parameter in the Scilab console.

#include <stack-c.h>
#include <sciprint.h>

int sci_check_properties_2(char * fname)
  int m1,n1,l1;

  CheckLhs(0,1) ;

    case sci_matrix: 
      GetRhsVar(1, "d", &m1, &n1, &l1);
      sciprint("1 is a scalar matrix\n");
    case sci_strings:
      GetRhsVar(1, "c", &m1, &n1, &l1);
      sciprint("1 is a string\n");
    case sci_sparse:
      sciprint("1 is a sparse trying to overload\n");

  LhsVar(1) = 0;

  return 0;

    <para>The builder.sce script look like this:</para>

    <programlisting role = "example"><![CDATA[  
// This is the builder.sce 
// must be run from this directory 


ilib_name  = 'lib_check_properties';

files = ['check_properties.c'];

libs  = [];

table =['chprop2', 'sci_check_properties_2'];

// We must be careful when we choose a scilab function name in case of overloading.
// We Scilab name function must be 8 char max.

ldflags = "";
cflags  = "";
fflags  = "";


And now, an example of use of this new function:


// overload case 

deff('[]=%sp_chprop2(sp)','disp(''sparse overloaded'')');
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jan 26 16:24:17 CET 2011