-
Notifications
You must be signed in to change notification settings - Fork 8
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
Do not generate bindings for functions implemented in the header #120
Comments
Actually a lot of libraries are defined entirely in an amalgamated header file, so it's not this I think this is down to
Need to read this more carefully: https://www.greenend.org.uk/rjk/tech/inline.html normal functions defined in headers are a fair game, but various inline functions are at compiler's mercy, and as such aren't guaranteed to be present in the object file. I feel like as a stopgap those shouldn't be generated at all if they are marked "inline" (regardless of Did you find a linking error attempting to use it? |
Yes I did, you can see in armanbilge/fs2-io_uring#2. |
Hmm, so should this be considered internal API then? Because as it stands it's sort of at compiler's mercy to include/not include it. If you got a linking error, that means the shared library for io_uring doesn't have an entry for this function - which must mean you're supposed to use some other means of achieving the same effect? |
No, it's public API.
I'm not sure what you mean.
If I were writing C code, I would include the header and that function would be available to me via that.
Yes I believe so, but now it is much more annoying. My two options are:
|
What I'm trying to get at is that
If we just compile that, you can see that the inline function is elided:
And even though Now, if you use the inline function in the source that produces your binary artifact (liburing.dylib, for exaple), then inline function can be added there:
What I'm saying is that
|
Now, bindgen could generate a glue C function for an inlined one, thus ensuring that the compiler will add the inline function to list of symbols in the resulting object artifacts |
Hmm I see. Possibly true.
It's because when I include the header that function definition will be in my sources (post-preprocessor). So if it gets inlined, no problem, and if it doesn't, then it will still be defined in my object files. No? |
Yes, if you accompany a binary liburing artifact with your own sources that exercise these inlined functions, then they should either be preserved, or fully inlined - and this means that the C functions you write shouldn't notice either way. That's my understanding at least - which means that bindgen can generate Scala functions that invoke wrappers that invoke inline functions... |
Right, I wasn't aware there was another way to use these functions 😛 |
I've created #121 to track this particular improvement. |
https://github.com/axboe/liburing/blob/0535620c15e1133f9c19aefe9e928e0607e6c2b2/src/include/liburing.h#L283-L309
They will compile but graduate to linking errors.
The text was updated successfully, but these errors were encountered: