help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Correct way to throw exceptions/errors from C to ST


From: Roland Plüss
Subject: Re: [Help-smalltalk] Correct way to throw exceptions/errors from C to ST
Date: Sun, 05 Apr 2015 00:21:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]