1#![stable(feature = "core_ffi", since = "1.30.0")]
10#![allow(non_camel_case_types)]
11
12#[doc(inline)]
13#[stable(feature = "core_c_str", since = "1.64.0")]
14pub use self::c_str::CStr;
15#[doc(inline)]
16#[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")]
17pub use self::c_str::FromBytesUntilNulError;
18#[doc(inline)]
19#[stable(feature = "core_c_str", since = "1.64.0")]
20pub use self::c_str::FromBytesWithNulError;
21use crate::fmt;
22
23#[stable(feature = "c_str_module", since = "1.88.0")]
24pub mod c_str;
25
26mod va_list;
27#[stable(feature = "c_variadic", since = "CURRENT_RUSTC_VERSION")]
28pub use self::va_list::{VaArgSafe, VaList};
29
30mod primitives;
31#[stable(feature = "core_ffi_c", since = "1.64.0")]
32pub use self::primitives::{
33 c_char, c_double, c_float, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint,
34 c_ulong, c_ulonglong, c_ushort,
35};
36#[unstable(feature = "c_size_t", issue = "88345")]
37pub use self::primitives::{c_ptrdiff_t, c_size_t, c_ssize_t};
38
39#[doc = include_str!("c_void.md")]
48#[lang = "c_void"]
49#[repr(u8)]
50#[stable(feature = "core_c_void", since = "1.30.0")]
51pub enum c_void {
52 #[unstable(
53 feature = "c_void_variant",
54 reason = "temporary implementation detail",
55 issue = "none"
56 )]
57 #[doc(hidden)]
58 __variant1,
59 #[unstable(
60 feature = "c_void_variant",
61 reason = "temporary implementation detail",
62 issue = "none"
63 )]
64 #[doc(hidden)]
65 __variant2,
66}
67
68#[stable(feature = "std_debug", since = "1.16.0")]
69impl fmt::Debug for c_void {
70 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
71 f.debug_struct("c_void").finish()
72 }
73}
74
75#[cfg(all(windows, target_env = "msvc"))]
77#[link(
78 name = "/defaultlib:msvcrt",
79 modifiers = "+verbatim",
80 cfg(not(target_feature = "crt-static"))
81)]
82#[link(name = "/defaultlib:libcmt", modifiers = "+verbatim", cfg(target_feature = "crt-static"))]
83unsafe extern "C" {}
84
85mod runtime_symbols {
89 use crate::ffi::{c_char, c_int, c_void};
90
91 unsafe extern "C" {
92 #[rustc_canonical_symbol]
93 fn memcpy(dest: *mut c_void, src: *const c_void, n: usize) -> *mut c_void;
94
95 #[rustc_canonical_symbol]
96 fn memmove(dest: *mut c_void, src: *const c_void, n: usize) -> *mut c_void;
97
98 #[rustc_canonical_symbol]
99 fn memset(s: *mut c_void, c: c_int, n: usize) -> *mut c_void;
100
101 #[rustc_canonical_symbol]
102 fn memcmp(s1: *const c_void, s2: *const c_void, n: usize) -> c_int;
103
104 #[rustc_canonical_symbol]
105 fn bcmp(s1: *const c_void, s2: *const c_void, n: usize) -> c_int;
106
107 #[rustc_canonical_symbol]
108 fn strlen(s: *const c_char) -> usize;
109 }
110}