Re: Correct way to throw exceptions/errors from C to ST

Roland Plüss <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>

On 04/04/2015 06:24 PM, Holger Hans Peter Freyther wrote:
> On Sat, Apr 04, 2015 at 02:50:01AM +0200, Roland Plüss wrote:
>
> Oh,
>
>> gst_eval_code( "SystemExceptions.InvalidArgument new signal" );
>>
>> But this causes the VM to call abort since an exception happened outside
>> the bytecode. I assume you need to be more clever in this case. So what
>> is the correct way to throw these kinds of exceptions from inside a C
>> function?
> Oh I don't know. The signal should occur once is out of C. E.g.
> you should be able to return an instance of InvalidArgument and
> in the Smalltalk code that triggered the C call-out check for the
> response and then signal it?
>
I don't know. I tried an example like this:

C++: => gst_perform( something )
Smalltalk: something[] => do a cCall (let's say cc)
C++: => cc: thrown exception using gst_eval_code(
"SystemExceptions.InvalidArgument new signal" );

Now let's say I try to catch the exception in Smalltalk. If I'm not
wrong it would look something like this:

something [
   [ anObject aCCallThatThrows ] on: Exception do: [ 'a test' printNl ]
]

But the exception is not handled but abort called by the byte code.
Could it be it fails because I'm using gst_perform?

-- 
Mit freundlichen Grüssen
Plüss Roland

Leader und Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
- Sowie verschiedene Blender Export-Skripts und Game-Tools

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUgY9YACgkQjKGu9ysRWfoEDQCeKmaLhHBWIWrxmj2EFzKcfII4
ynAAnAnabc/IFW0wR+lVyd82V2RTeUOa
=T0Tg
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.