stdlib: Inference engine caught some type errors! Also added some hot garbage.

This commit is contained in:
2025-07-18 05:34:03 -04:00
parent 8732cca3f9
commit 0f9044bb3e
9 changed files with 129 additions and 55 deletions

34
stdlib/ffi.cl Normal file
View File

@@ -0,0 +1,34 @@
//! Conlang FFI
use super::preamble::*;
type void = ();
#[extern("C")]
/// void free(void *_Nullable ptr);
///
/// Frees a block of memory previously allocated with `malloc`
fn free(ptr: *void);
#[extern("C")]
/// void *malloc(size_t size);
///
/// Allocates a block of uninitialized memory
fn malloc(size: usize) -> *void;
#[extern("C")]
/// void *calloc(size_t n, size_t size);
///
/// Allocates a block of zero-initialized memory
fn calloc(n: usize, size: usize);
#[extern("C")]
/// void *realloc(void *_Nullable ptr, size_t size);
///
/// Reallocates a block of memory to fit `size` bytes
fn realloc(ptr: *void, size: usize) -> *void;
#[extern("C")]
/// void *reallocarray(void *_Nullable ptr, size_t n, size_t size);
///
/// Reallocates a block of memory to fit `n` elements of `size` bytes.
fn reallocarray(ptr: *void, n: usize, size: usize) -> *void;