[CM] C Stack Unwinding

Woody Douglass wdouglass at carnegierobotics.com
Tue Nov 2 18:11:29 PDT 2021


Hey all, I have a question about s7 error handling in C. consider the
attached c file.
It uses `s7_call_with_catch` to call a function that's defined in C,
but has an error. The error handler gets invoked, but the result of it
is returned at line 4, from s7_eval_c_string, and not from
s7_call_with_catch at line 23. also, an "unknown operator" error gets
printed.

I made the (bad) assumption that s7 used some setjmp/longjmp magic to
unwind the C stack when an error gets invoked to the catch location.
lesson learned. Is there a more elegant way to detect errors then
"check after every s7 function call"? am i missing something here?

Thanks so much,
Woody Douglass.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testerror.c
Type: text/x-csrc
Size: 951 bytes
Desc: testerror.c
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20211103/70cfda04/attachment.bin>


More information about the Cmdist mailing list