[cffi-devel] C++ Exceptions.

Collin Lynch collinl at cs.pitt.edu
Tue Feb 13 06:08:02 UTC 2007


As I said in another e-mail I made use of SWIG's C++ parsing by having it
generate the wrapper code.  It did fine on that score but had issues with
the generated Clos code forcing me to hand-edit the result.

	Collin Lynch.


On Mon, 12 Feb 2007, James Bielman wrote:

> On Mon, 2007-02-12 at 16:44 +0000, Luís Oliveira wrote:
> > On 12/02/07, Collin Lynch <collinl at cs.pitt.edu> wrote:
> > > In any case, is there any way to catch the underlying c++ exceptions
> > > within a cffi-wrapper?  I have developed a C++ library that defines its
> > > own exceptions and I would like to trap them and generate an appropriate
> > > Lisp Condition.  At present deliberately triggering an error (say by
> > > passing incorrect parameters to a constructor) gives me back a null
> > > pointer.
> >
> > C++ support would be nice. I don't personally have a need for it, but
> > it would be nice. Patches are welcome! :-)
>
> Personally, I consider C++ so deliberately hostile to interfacing
> with other languages that I'm not sure I'd even want to be responsible
> for maintaining code for binding to C++ libraries.
>
> As I understand it, there's not even a platform ABI that one can try to
> conform to---things like C++ exception handling and name mangling
> differ not only per-compiler, but vary depending on the version of
> the compiler being used.  (ISTR maybe they did this for amd64?  But
> I don't think there is in the general case...)
>
> > Otherwise, you can handle exceptions and other C++ stuff by writing
> > some C glue and calling that with CFFI.
>
> Unfortunately I think this is the most sane way to go at this point.
>
> I suppose another option would be some kind of standard network
> object protocol like CORBA, but that's a whole separate mess...
>
> James
>
>




More information about the cffi-devel mailing list