-
Notifications
You must be signed in to change notification settings - Fork 13.3k
refactor liblibc into finer-grained crates #17547
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
If you're interested in taking this on, please leave a comment on this issue so we can coordinate work with other ongoing changes to the libraries. |
I'd personally prefer to split it based on whether it is part of the C standard, part of POSIX, or part of WinAPI. On Windows there are many windows-specific versions of the posix functions, so it seems like a better idea to keep them in |
It's also worth considering automating the generation of these bindings as part of this refactoring. |
As part of this refactoring, in many crates there are definitions for winapi/posix things and they should be moved into these crates. I'd opt for these crates to be universal crates containing bindings to everything rather than just what is used in rustc. |
Portability across different C standard library implementations is unrealistic if it's not auto-generated. It can't be split as suggested in the issue if it's done sanely. It should all be auto-generated from the headers with no Rust-specific design or organization involved. |
I've written posix bindings for x86_64 and x86 linux before and I've generated the structures for x86 with a program (see the posgen directory.) I strongly advice you to do the same here (but with a much older glibc.) Those structures can be very hard to wrap and I wouldn't expect hand-wrapped structures to be correct. |
why not something like |
@sinistersnare: Rust-specific organization means it can't be auto-generated from headers. It will involve a lot of design / organization work and it will always be non-portable and missing functionality. Any proposal involving organization not there on the C end is a bad one. |
I also think auto generating bindings is an excellent idea as i rather get link errors in rust land. Splitting C bindings by standard, and additional having kernel-specific libs strikes me as a good idea. @thestinger do you think these goals are compatible? |
How are we going to re-export things in |
@retep998 I'm not sure I follow the question. Which re-exports do you have in mind? The idea here was just that |
@aturon So what you propose is that |
I'm slowly working on my own winapi bindings out of tree at https://github.com/retep998/winapi-rs |
@retep998 I would personally expect libwinapi to depend on liblibc for types like I do also think though that liblibc has too many things today, and we may want to refactor it into finer grained dependencies (but I don't wanna go too overboard with this). |
Work on the libc create is ongoing as part of rust-lang/rfcs#1291, and there hasn't been discussion here in almost a year, so I'm going to give it a close in favor of that. |
internal: Clean up runnable lsp extension This feels like a natural addition to me, and also allows us to drop the expect-test hardcoding from the extension. Additionally, `cargoExtraArgs` is pointless, all the client will do is merge it with `cargoArgs` so the server can do that instead of delegating that to the client.
The libc crate currently provides a large set of bindings to C APIs. Some of these are cross-platform. But the crate also exports a large number of platform-specific APIs.
It was initially carefully organized according to various standards, but over time it has become a dumping ground for bindings.
As part of the runtime removal RFC we would like to refactor the crate into smaller pieces:
liblibc/lib.rs
, and encompasses universal C bindings.#[cfg(unix)]
platform.#[cfg(windows)]
platform.Ultimately, we are likely to add additional crates like
liblinux
to provide even more specific sets of bindings.Due to the top-level exports in
liblibc
, it should be possible to do this refactoring without overly painful breakage.The text was updated successfully, but these errors were encountered: