objc_sys/
libc.rs

1use core::ffi::c_void;
2
3// SAFETY: The signatures in here are the exact same as in `libc`.
4extern_c! {
5    /// The Objective-C runtime has several methods, usually with "`copy`" in
6    /// their name, whose return value is allocated with C's `malloc` and
7    /// deallocated with C's `free` method.
8    ///
9    /// As such, `free` is actually also part of the Objective-C runtime.
10    ///
11    /// We expose this instead of using [`libc::free`], to avoid having `libc`
12    /// as a dependency.
13    ///
14    /// [`libc::free`]: https://docs.rs/libc/latest/libc/fn.free.html
15    //
16    // Note: This is linked automatically by either `std` or transitively by
17    // `libobjc`.
18    pub fn free(p: *mut c_void);
19}