Added memory management function calls to the C library.

This commit is contained in:
Myrddin Dundragon 2017-03-05 17:32:09 -05:00
parent 43abe9d95f
commit a320296f18
3 changed files with 17 additions and 0 deletions

View File

@ -4,11 +4,15 @@
mod errno;
mod stddef;
mod stdlib;
mod string;
mod time;
pub use self::errno::*;
pub use self::stddef::*;
pub use self::stdlib::*;
pub use self::string::*;
pub use self::time::*;

2
src/c/stddef.rs Normal file
View File

@ -0,0 +1,2 @@
/// This defines the size_t type.
pub type size_t = usize;

11
src/c/stdlib.rs Normal file
View File

@ -0,0 +1,11 @@
use binding::CVoid;
extern
{
pub fn calloc(nobj: usize, size: usize) -> *mut CVoid;
pub fn malloc(size: usize) -> *mut CVoid;
pub fn realloc(p: *mut CVoid, size: usize) -> *mut CVoid;
pub fn free(p: *mut CVoid);
}