esp_idf_sys/patches.rs
1// (Temporary code) ESP-IDF does not (yet) have a pthread rwlock implementation, which is required by STD
2// We provide a quick and very hacky implementation here
3mod atexit;
4#[cfg(feature = "std")]
5mod lstat;
6
7#[allow(dead_code)]
8pub struct PatchesRef(*mut core::ffi::c_void, *mut core::ffi::c_void);
9
10/// A hack to make sure that certain symbols are linked to the final executable
11/// Call this function once e.g. in the beginning of your main function
12pub fn link_patches() -> PatchesRef {
13 #[cfg(feature = "std")]
14 let lstat = lstat::link_patches();
15 #[cfg(not(feature = "std"))]
16 let lstat = core::ptr::null_mut();
17
18 let atexit = atexit::link_patches();
19
20 PatchesRef(lstat, atexit)
21}