Skip to content
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

Errors crash the code when using C interface #1374

Open
eschnett opened this issue Feb 25, 2025 · 2 comments
Open

Errors crash the code when using C interface #1374

eschnett opened this issue Feb 25, 2025 · 2 comments

Comments

@eschnett
Copy link
Contributor

I notice that run-time errors (e.g. trying to open a non-existing file) throw an exception. The C interface doesn't allow catching these exceptions and thus always crash the code.

I am currently examining writing a Julia wrapper https://github.com/eschnett/Conduit.jl using the C interface and this would be a serious problem.

@cyrush
Copy link
Member

cyrush commented Feb 26, 2025

@eschnett thanks for this report and we understand this issue.

Here is a related discussion of a possible path forward:

#1065

To summarize - two options:

  • Provide an error status function and try / catch to avoid exceptions reaching C -- (I think this is pragmatic path foward)

  • A new C API that provides error code for all calls.

@eschnett
Copy link
Contributor Author

Thanks. (FWIW, from a cleanliness point of view I'd prefer a new API that returns error codes.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants