[Pyrex] pyrex and g++

Josiah Carlson jcarlson at uci.edu
Fri Sep 23 23:24:13 CEST 2005


"Lenard Lindstrom" <len-l at telus.net> wrote:
> 
> I don't think the problem is making Pyrex generate code that can compile as C++. I 
> think the problem is that the module will be used by an interpreter written and 
> compiled in pure C. What happens if a C++ exception is thrown and not caught 
> before returning to interpreter's call on a module function. Will the C stack continue 
> to unwind and cause the interpreter to crash? Does declaring a C++ function 'extern 
> "C"' ensure that any unhandled C++ exceptions are stopped in their tracks before 
> they can do harm in C code? ( A quick test using MinGW 3.2.3 shows an exception 
> thrown by a C++ function in a dynamic library causes an abnormal termination in a 
> C program calling it.)

I'm pretty sure it can be done, otherwise the Boost::Python guys (who
wrap C++ stuff for Python) would be SOL.  I don't know how to do it
myself (never having had the occasion to check), but I'm sure that
someone out there has done it, and could explain how it happens.

 - Josiah




More information about the Pyrex mailing list