Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.0.0 - Français


call_scilab

call_scilab is an interface which provides the ability to call Scilab engine from C/C++ code

Description

Scilab offers the possibility to be called from a native (C/C++) application.

Thanks to this module, it is possible to call Scilab from C/C++ in order to interface Scilab's features from another code/application or to be able to interface Scilab's features from another language.

Since Scilab 5.2.0, all Scilab datatype can be handle by call_scilab. This is done thanks to API_Scilab

This help describes the features of the call_scilab API.

Note: The javasci module is based on call_scilab.

Note: old APIs (stackX.h) will not be available after Scilab 6.0 (included).

Examples

// A simple call_scilab example

#include <stdio.h> /* stderr */

#include "api_scilab.h" /* Provide functions to access to the memory of Scilab */
#include "call_scilab.h" /* Provide functions to call Scilab engine */

// Filename: simple_call_scilab.c

int main(void)
{
/****** INITIALIZATION **********/
#ifdef _MSC_VER
 if ( StartScilab(NULL,NULL,NULL) == FALSE )
#else
 if ( StartScilab(getenv("SCI"),NULL,NULL) == FALSE )
#endif
  {
   fprintf(stderr,"Error while calling StartScilab\n");
   return -1;
  }

/****** ACTUAL Scilab TASKS *******/

 SendScilabJob("myMatrix=['sample','for the help']");
 SendScilabJob("disp(myMatrix);"); // Will display !sample  for the help  !
 SendScilabJob("disp([2,3]+[-44,39]);"); // Will display   - 42.    42.

/****** TERMINATION **********/
 if ( TerminateScilab(NULL) == FALSE ) {
  fprintf(stderr,"Error while calling TerminateScilab\n");
  return -2;
 }
 return 0;
}

History

VersionDescription
5.4.0 New methods added:
  • CallScilab.h removed (was deprecated since Scilab 5.2.0). Replaced by call_scilab.h
  • Function int getLastErrorValue(void); added. Returns the last error code generated by Scilab
  • Function const char* getLastErrorMessageSingle(); added. Returns the last error message generated by Scilab
  • Remove deprecated functions in call_scilab.h: C2F(readmat), C2F(creadmat), C2F(creadbmat), C2F(creadcmat), C2F(readchain), C2F(creadchain), C2F(creadchains), GetLengthStringMatrixByName, C2F(matptr), C2F(cmatptr), C2F(cmatcptr), C2F(cmatsptr), C2F(cmatbptr), getlengthchain

See also

  • api Scilab — api_scilab is the Scilab 6 interface to access Scilab variables.
  • Compile and run with call_scilab — How to compile a native application based on or using Scilab
  • Matrix Management — How to manage Scilab's variable read and write process using call_scilab and api_scilab
  • Boolean Management — How to manage Scilab's boolean read and write process using call_scilab and api_scilab
  • Complex Management — How to manage Scilab's complex variable read and write process using call_scilab
  • String Management — How to manage Scilab's String read and write process using call_scilab and api_scilab
Report an issue
<< Boolean management API call_scilab (moteur Scilab) Compile and run with Call Scilab >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Oct 24 14:34:20 CEST 2023