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

Add bindings for LibC::Statfs #6056

Closed
wants to merge 3 commits into from
Closed

Add bindings for LibC::Statfs #6056

wants to merge 3 commits into from

Conversation

j8r
Copy link
Contributor

@j8r j8r commented May 3, 2018

This work is based on ztypes of https://golang.org/src/syscall.
This is the first time I do this, not sure what do choose between Long, Int and Int32.
I haven't indeed tested on all platforms, but works at least on x86_64-linux-musl.
Fix #6053

@straight-shoota
Copy link
Member

What's the catch with having these bindings definitions without using them anywhere?

@j8r
Copy link
Contributor Author

j8r commented May 3, 2018

Users can use them directly. Crystal has LibC binding included, and de facto supports it (but maybe I'm wrong).
There is something wrong not to want to fully support it. There is no sense to create a shard "LibC2" that duplicates the existant bindings in addition to other poor ones rejected.

@RX14
Copy link
Contributor

RX14 commented May 3, 2018

LibC is there only for the stdlib to use. If you need LibC bindings that the stdlib doesn't use, you should add them yourself where those bindings are used. The LibC bindings are not a public or documented feature of the compiler.

@RX14 RX14 closed this May 3, 2018
@RX14
Copy link
Contributor

RX14 commented May 3, 2018

How about moving LibC to Crystal::LibC to make that clear (and to allow a possible future external shards to bind LibC completely)?

@j8r
Copy link
Contributor Author

j8r commented May 4, 2018

I think we should do like rust did (https://github.com/rust-lang/libc), creating https://github.com/crystal-lang/libc .

@RX14
Copy link
Contributor

RX14 commented May 4, 2018

we should probably make the infrastructure for automatically generating those bindings repeatable too (i.e. automate downloading the required libc headers to generate the libc bindings from) as well.

Then we just have one bindgen config for the std and one for the libc project.

@j8r
Copy link
Contributor Author

j8r commented May 4, 2018

| The LibC bindings are not a public or documented feature of the compiler.

LibC bindings is a part/feature of the compiler?! It doesn't has to. Docs are also always good.
Generation won't fix everything - variables aren't nice, and some other things has to be manually fixed/added.

At least, is it possible to have libc related stuff on its repository (submodule, subtree or shard)?

@j8r
Copy link
Contributor Author

j8r commented May 4, 2018

At the end, I will be happy with any solution that permits us to complete the LibC bindings (and close the gap to other languages that Rust/Go). It would be too bad to fork this to a new non-official shard.

@RX14
Copy link
Contributor

RX14 commented May 4, 2018

The LibC bindings are not a public or documented feature of the compiler.

That was a typo, sorry, I meant to say part of the stdlib.

Generation won't fix everything - variables aren't nice, and some other things has to be manually fixed/added.

Not true, the headers contain all the information required. If this wasn't the case, then C wouldn't be able to use libc either.

@j8r
Copy link
Contributor Author

j8r commented May 4, 2018

I've changed the title, let's shift the talk to #6053.

@j8r j8r deleted the statfs branch October 16, 2018 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants