Compile with g++ to make libgf2x++.so, and embed exception-throwing code.
Imported issue: Initially reported by @thome in https://gforge.inria.fr/tracker/?group_id=1874&aid=21384
The main catch is about dealing with temporary allocation.
We could use the mechanism hinted at through various discussions there:
https://gmplib.org/list-archives/gmp-devel/2014-December/thread.html
It's quite a bit of work though, as we need to police:
-
all spots where we abort().
-
all malloc() and realloc() calls.
and embed that in a consistent and transparent way, so that we can do magic tricks when (and only when) we use a c++ compiler.
Note that while the mpfq code has some allocation, none of that is used in gf2x.