Hi Marc,
#ifdef USE_POSIX if (close (d->fd) < 0) return err_code_from_errno (); #endif
This (in os_tty.c) must be commented out too, otherwise the controlling terminal will be closed when you get to the printf("cleanup done") which follows the call to ___cleanup. Please try that.
*** I had tried that also, but it didn't work either.
I think we are losing track of the original problem. The problem here is related to closing the file descriptors at the wrong time, so that subsequent output to the terminal (and stdout) do not occur. The original problem that you had was that Python was exiting with a non-zero process status. I don't think we are closer to a solution for that.
*** I had tried getting help on the Cython mailing list on this also, incase the difficulty was arising from that. The suggestion was to first try calling the shared library using C and skipping any Cython stuff. That's where this came from -- I'm using gambit_tester.c to attempt to do in C only what I'd like to do using Python. I had also tried using Cython to create a standalone, but this didn't work either:
# This is for testing if Cython can at least get this running as a standalone print __name__
if __name__ == "__main__": print "Beginning Gambit-C setup" setup () print "Testing Gambit-C" my_str = "(+ 1 2)" print "Evaluating " + my_str + " :" eval(my_str) print "Beginning Gambit-C cleanup" cleanup () else: print "Huh?"