Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - English


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 call_scilab API (Scilab engine) GetLastJob >>

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:
Mon Jun 17 17:49:22 CEST 2024