mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
define roc_alloc and friends in cli/src/lib.rs on windows
This commit is contained in:
parent
f2b2adb550
commit
1f778db26c
1 changed files with 34 additions and 0 deletions
|
@ -1191,3 +1191,37 @@ impl std::str::FromStr for Target {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
use windows_roc_platform_functions::*;
|
||||
|
||||
#[cfg(windows)]
|
||||
mod windows_roc_platform_functions {
|
||||
use core::ffi::c_void;
|
||||
|
||||
/// # Safety
|
||||
/// The Roc application needs this.
|
||||
#[no_mangle]
|
||||
pub unsafe fn roc_alloc(size: usize, _alignment: u32) -> *mut c_void {
|
||||
libc::malloc(size)
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
/// The Roc application needs this.
|
||||
#[no_mangle]
|
||||
pub unsafe fn roc_realloc(
|
||||
c_ptr: *mut c_void,
|
||||
new_size: usize,
|
||||
_old_size: usize,
|
||||
_alignment: u32,
|
||||
) -> *mut c_void {
|
||||
libc::realloc(c_ptr, new_size)
|
||||
}
|
||||
|
||||
/// # Safety
|
||||
/// The Roc application needs this.
|
||||
#[no_mangle]
|
||||
pub unsafe fn roc_dealloc(c_ptr: *mut c_void, _alignment: u32) {
|
||||
libc::free(c_ptr)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue