[prev in list] [next in list] [prev in thread] [next in thread] 

List:       scilab-users
Subject:    [Scilab-users] Scilab 6.0 C++ API // Crashes due to function calls via overloading mechanism
From:       Dirk Reusch <lists () kybdr ! de>
Date:       2017-02-23 9:57:40
Message-ID: 20170223105740.4387246a () lemon
[Download RAW message or body]

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
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic