-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Move std::os::raw to libcore? #36193
Comments
Historically, my understanding is that |
My understanding is that it doesn’t depend on API or other things provided at run-time by an OS, but that doesn’t mean it can’t have things that compile differently based on the target/platform.
|
Yes historically we have not done this because of what @steveklabnik said. These types are OS-specific, not architecture specific, which I believe the other flags you're mentioning @SimonSapin are. This is also why the libc crate has a |
Ohh, I didn’t know about that. Thanks! |
Well, current Regardless, I don’t understand why having |
Regarding I personally don't hold an opinion either way on whether this sort of stuff should be in |
These are target specific, not OS specific aren't they? And there's other target specific stuff in |
Not exactly. For example on x86_64, |
Moving these types into core without breaking compatibility with the |
Yes, but I would say it's because they are different "targets" or ABIs. It's not like they are consistent on an OS, i.e., |
Prior discussion: https://internals.rust-lang.org/t/solve-std-os-raw-c-void/3268/ |
I think that if:
the status quo would make sense. But is Also, calling C code is not uncommon for Furthermore, a couple of SIMD intrinsics are specified with
Maybe we should change that, but right now it means that |
I've been using the cty crate to get C types in |
Could expose cty in core as |
Although it’s in an internal implementation detail rather than in a public API, libcore now has: #[cfg_attr(not(any(target_os = "emscripten", target_os = "redox",
target_endian = "big")),
repr(simd))]
struct Block(u64, u64, u64, u64); which does depend on the OS. Anyway, I still don’t understand why this distinction is useful. Compiled libcore is distributed together with libstd, in "targets" that are both OS-specific and architecture specific. |
New RFC to propose this more formally, but only for |
I like you idea, the ctypes and some basic type should be in a non_std crate and distribute with rust. |
Merge cty into core named with ctype? |
Also, cty lost these type:
|
This has recently been implemented as an unstable feature, tracking issue here: #94501 |
Closing in favor of the tracking issue. |
I’m currently playing "embedded" with hardware (ARM Cortex-M CPU with 64 KB RAM). I’m using
#![no_std]
(there’s no operating system) and FFI to use C and C++ device drivers.For bindings I’d like to use
std::os::raw::c_long
and other types in that module. But this module is not available in libcore. Is there a reason for this? If not, I’ll submit a PR to move it (and of course re-export it at its current location).The text was updated successfully, but these errors were encountered: