mirror of
https://github.com/Noratrieb/libuwuc.git
synced 2026-03-15 00:26:06 +01:00
move
This commit is contained in:
parent
de90913d46
commit
54e0e7604e
23 changed files with 77 additions and 33 deletions
13
c/Cargo.toml
Normal file
13
c/Cargo.toml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[package]
|
||||
name = "c"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
crate-type = ["rlib"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
libuwuc = { path = "../libuwuc" }
|
||||
11
c/src/lib.rs
Normal file
11
c/src/lib.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#![no_std]
|
||||
|
||||
mod string;
|
||||
|
||||
// libcore seems to require this symbol, even though it's unused.
|
||||
#[no_mangle]
|
||||
fn rust_eh_personality() {
|
||||
unsafe {
|
||||
libuwuc::trap!();
|
||||
}
|
||||
}
|
||||
13
c/src/string.rs
Normal file
13
c/src/string.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#[no_mangle]
|
||||
pub(crate) unsafe extern "C" fn memset(ptr: *mut u8, constant: u8, len: usize) {
|
||||
for i in 0..len {
|
||||
unsafe {
|
||||
*ptr.add(i) = constant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub(crate) unsafe extern "C" fn strlen(s: *const u8) -> usize {
|
||||
libuwuc::mem::strlen(s)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue