On Aug 22, 2:23 am, Juanjo <juanjose.garciarip...@googlemail.com>
wrote:

> A C function can be used to deactivate trapping of signals

Thanks! that is probably a more elegant way. I found the POSIX
"sigaction" which allows signal handlers to be read and set. Bracing
cl_boot between an appropriate amount of those seems to do the trick.

Incidentally, <signal.h> must be one of the most painful headers to
translate into cython: It uses both a function "sigaction" and a data
type "struct sigaction". Since cython squashes the struct namespace
into the general namespace, there are some collisions to work around.

> >  2. sage segfaults upon exit if ecl has run
>
> Run cl_shutdown() manually before Sage exits. ECL registers its own
> exit handler using atexit(), perhaps that is the problem.

running cl_shutdown manually doesn't seem to be correlated. I tried
removing the one atexit() call that appears in the ecl source, but the
segfault still occurs. The segfault only occurs after sage has printed
its goodbye message, so it's definitely something in the cleanup
process and it doesn't really functionally affect anything. A C-level
debug wizzard would probably find the offence in no-time.

This is the only unresolved issue for now, because:

> >  3. ecl by default  has an error handler that doesn't work well inside
> > sage
>
> In what sense?

I think browsing your replies to other people's questions solved that
one (good candidate to include in embedding examples!):

si_safe_eval(3,obj,NIL,NULL)

evaluates obj and returns NULL upon error. It seems that NULL is a
completely illegal cl_object, so that is sufficient to properly detect
an error condition. (of course, by now we have completely lost any
idea of *what* the error was. Or does the "last raised error message"
get cached somewhere?)

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to