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

[ffigen] Generate C wrappers for capturing errno #966

Open
dcharkes opened this issue Feb 14, 2024 · 0 comments
Open

[ffigen] Generate C wrappers for capturing errno #966

dcharkes opened this issue Feb 14, 2024 · 0 comments

Comments

@dcharkes
Copy link
Collaborator

Two subsequent FFI calls are not atomic from an OS point of view.
This means that accessing GetLastError and errno are flaky.
With the work progressing on native assets, our current idea to address this is to wrap the existing C call:

We'd rather not have users write wrappers by hand. So maybe we can explore generating them with FFIgen.

Some example uses of the APIs can be found in this abandoned CL: https://dart-review.googlesource.com/c/sdk/+/240847

Possible way of configuring wrappers

functions:
  capture-errno:
    - '.*'
  capture-GetLastError:
    - '.*'

And we should probably generate a return type that is a tuple with the potential error and the normal return value.

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

No branches or pull requests

1 participant