Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> API Scilab > API Scilab

API Scilab

api_scilab is the Scilab 6 interface to access Scilab variables.

Description

The API for Scilab 6 is a new set of C APIs in Scilab 6 to write C or C++ extensions (toolboxes) to Scilab. It allows defining native functions (commonly called “gateways”), getting input parameters for such functions, setting return parameters, accessing local variables, using common helper functions for accessing environment information (such as warning level), generate errors... It also includes ways to overload existing Scilab functions to support additional parameter types (see scilab_overload). Finally, you can call back Scilab functions (macros and built-in functions) from your gateway (see scilab_call).

The API for Scilab 6.0 can also be used to access data in Scilab from another application. A specific set of functions is provided for calling scilab (see call_scilab), but then the API is the same to access data - for example, to access the variables by name.

The previous API is still available for backward compatibility. But the new API is the only one that will be maintained in the long term. The old API will be deprecated in a soon-to-come release (most likely in Scilab 6.1), and will likely be removed entirely in the subsequent release (most likely in Scilab 6.2).

This new API has better performance than the old one, because it accesses the internal types directly. The API is also simpler, because it does not rely on the “stack” object that was at the core of earlier versions of Scilab, and which has been removed from Scilab 6. The API naming convention should also be clearer than the old version, and even simpler than comparable APIs in similar products.

Thus, new gateways should only use this new API.

To use the API, only “api_scilab.h” needs to be included in your C code; all API functions are then available. If you write C++ code, you can use the API the same way. You only need to wrap the #include “api_scilab.h” in an extern “C” { … } block. More information are provided in API Scilab getting started.

Code optimization

If your code does an important amount of access of variables, in particular in loops, then you may want to compile with the __API_SCILAB_UNSAFE__ flag defined (through a “#define” positioned before the “#include “api_scilab.h”, or -D in the compiler options). It does not change the API’s behavior but reduces the amount of input and output parameters checked done when you call the APIs, thus may improve the performance.

Report an issue
<< legacy API Scilab API types >>

Copyright (c) 2022-2024 (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 Feb 14 15:10:43 CET 2017