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


ExecScilabCommand

Execute a Scilab from a C/C++ code (call_scilab) and can get message and callstack on error.

int ExecScilabCommand(char* cmd, char** msg, char** stack)

Description

This fonction is provided in call_scilab. This function execute a command by the Scilab engine.

In case of error, it can fill buffers to get error message and/or callstack information.

Arguments

cmd

a standard C char* containing the Scilab commands

msg

in case of error during execution and if msg != NULL, engine will fill buffer with error message

msg must be free.

stack

in case of error during execution and if stack != NULL, engine will fill buffer with callstack information

stack must be free.

returns

0 if the execution is successful.

-1 if the execution fails.

Examples

// A simple ExecScilabCommand example

StartScilab(NULL, NULL, 0);

char* errmsg = NULL;
char* errstack = NULL;
int err = ExecScilabCommand((char*)"cosd(\"a\")", &errmsg, &errstack);
if (err)
{
    std::cout << "Msg: " << errmsg << std::endl;
    std::cout << "Stack: " << errstack<< std::endl;

    free(errmsg);
    free(errstack);
}

See also

Report an issue
<< DisableInteractiveMode API call_scilab (moteur Scilab) fromc >>

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:
Thu Oct 24 11:16:04 CEST 2024