-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Exception Support #1412
Comments
Thanks for getting in touch. I can see that this would indeed be pretty painful. autocxx tries really hard to stick to the basic interop model of cxx, and exception handling in cxx works like this. So, to make this work in autocxx, we'd need to:
This sounds relatively straightforward so yes, I think I'd be open to patches to do this. |
I have been waiting for this feature for years. |
@torrancew When I needed this feature, I created xapian-rs, which is based on cxx, and later tried autocxx. The code is now in this branch: https://github.com/ttys3/xapian-rs/tree/autocxx. Autocxx is convenient and can automatically generate documentation, but it has a limitation: it doesn't support exceptions, while the cpp code of xapian does. |
@ttys3 Thanks! Sadly, I'm all too aware -- I have a couple of plain cxx-based xapian bindings laying around, as well. Xapian in particular has a lot of pain points with the cxx limitations (and some with autocxx too), but overall I found that I was able to build a much more complete set of bindings more quickly and with less C++ shim code via @adetaylor Thanks so much! I've got some familiarity with how Some other questions I've found myself asking along the way:
|
So, autocxx fundamentally works a bit like this:
So, I think the answers to your questions are that the exception handling will be literally that which is already in cxx. It's "just" a matter of giving cxx the right information. Re |
@adetaylor Thanks for the guidance. I've got a branch started, and have had some minor success (working support for wrapped primitives/POD, at least!), hit some snags, and surfaced a couple of questions worth exploring further. I'll send a draft PR over to start working through that stuff. A couple of things I've struggled with in particular:
|
Yes. Name handling is one of the messiest parts.
I'd suggest starting as simply as possible, and allowing Obviously, good diagnostics would be needed if |
First off, thank you for the excellent tooling you provide! I really appreciate
autocxx
, and it made it much easier to release torrancew/xapian-rs.In the process of writing the bindings, I ran into a few pain points, but the most difficult one was the lack of support for exceptions in
autocxx
. Upstream Xapian codethrow
s quite a bit, and it would be great to express most of those in the Rust bindings without resorting to writing almost everything by hand.Would you be open to receiving patches for this? If so, could you provide some high level guidance on how best to start? I'm fairly comfortable in Rust, but my C++ knowledge is... dated. I know enough to know that I don't know much, but I can usually get something that compiles thrown together -- but I'm willing to iterate if you're open to the patches and some potentially naive lines of questioning.
Thanks again!
The text was updated successfully, but these errors were encountered: