On Wed, Aug 11, 2010 at 3:42 PM, Carl Witty <[email protected]> wrote:

>
> Sure.  The issue with exceptions is almost trivial, but still important.
>
> According to the Mono P/Invoke documentation, P/Invoke is for talking
> to C functions.  If a function throws a C++ exception, it wasn't a C
> function.  And in particular, under Mono, if you P/Invoke a function
> that throws a C++ exception, very bad things happen; the exception
> can't be caught by managed code, and probably your application
> crashes.

Ok. This issue is likely the same in the java world - running a C++
function without C++ runtime support cannot work, hence the need for a
wrapper, like it is usually done when you want to dlopen a C++
library.

>
> In my opinion, the major advantage of C++/CLI over C# with P/Invoke is
> that C++/CLI has a working C++ header file parser.  This means that we
> can keep the current Cython semantics, where users describe to Cython
> the API (rather than the ABI) of the library they're trying to call;
> then Cython generates C, C++, or C++/CLI code that conforms to this
> API, and the compiler handles the rest.

So just to be sure I understand, using C++/CLI gives you a way to
generate the C++ wrapper needed to expose a C-like ABI to cython (and
python runtime) ? A bit like python boost does ?

It seems to me that having a "toolchain" to do this would also be
useful for auto-generating .pxd from header files directly. May be
enough to motivate me to continue the work I started there using clang

It seems that fixing this would solve the issue for both java and C#
output at the same time, which is a good point.

Thanks a lot for the info, that's useful, and this is exciting development.

David
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to