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)
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.
a standard C char* containing the Scilab commands
in case of error during execution and if msg
!= NULL, engine will fill buffer with error message
msg
must be free.
in case of error during execution and if stack
!= NULL, engine will fill buffer with callstack information
stack
must be free.
0 if the execution is successful.
-1 if the execution fails.
// 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); } | ![]() | ![]() |