[Scilab-users] Scilab 6.0 C++ API // Crashes due to function calls via overloading mechanism
Dirk Reusch
lists at kybdr.de
Thu Feb 23 10:57:40 CET 2017
Hello,
Using the precompiled "scilab-branch-6.0-1487071837" under Linux 64bit,
I am experiencing crashes "Segmentation fault (core dumped)".
I am trying to use the new C++ API to implement operations like
addition for an user-defined type, lets say "T".
To reproduce the crashes, I have stripped everything down to the
following minimal example:
1. Implementation of addition operation for Type "T" using C++ API:
-------------------------------------------------------------------
types::Function::ReturnValue sci_T_a_T(types::typed_list &in, int
_iRetCount, types::typed_list &out) { try
{
return types::Function::OK_NoResult;
}
catch(std::exception& e)
{
return types::Function::Error;
}
return types::Function::OK_NoResult;
}
2. Compile "sci_T_a_T" and map it to "%T_a_T" Scilab function
-------------------------------------------------------------
3. Use "%T_a_T" directly => OK
------------------------------
A=tlist("T");
B=tlist("T");
%T_a_T(A,B) // OK
4. Use "%T_a_T" via overloading mechanism of "+" operator => Crash
------------------------------------------------------------------
A=tlist("T");
B=tlist("T");
A+B // => Crashes Scilab (Segmentation fault (core dumped))
------------------------------------------------------------------
So, it seems that using "try-catch" is a problem, when the function is
called via Scilab's overloading mechanism!?
What am I doing wrong, or is it a bug of Scilab?
Please note, that avoiding "try-catch" is not really an option for me,
because I have to use C++ functions from a library with error reporting
via exceptions.
Thanks for any advice and further insight,
Dirk
More information about the users
mailing list