Modules

Runtime_Support

moduleSource

Available on macOS, Linux, Windows, Wasm·since 0.31.0

#import "Runtime_Support";

Module parameters#

DEFINE_SYSTEM_ENTRY_POINT: bool
Defines the program's system entry point.
DEFINE_INITIALIZATION: bool
Defines the initialization that runs before main.
ENABLE_BACKTRACE_ON_CRASH: bool
Installs the crash handler that prints a backtrace.

Procedures#

General#

Faults#

(pre_value: s64, pre_flags: u32, post_value: s64, post_flags: u32, fatal: u8, line_number: s64, filename: *u8)

Default heaps#

(mode: Allocator_Mode, requested_size: s64, old_size: s64, old_memory: *void, allocator_data: *void) -> *void

The allocator procedure. It handles .ALLOCATE, .RESIZE, .FREE, .CREATE_HEAP, .DESTROY_HEAP and .IS_THIS_YOURS; allocator_data is the heap, or null for the default one. Allocation returns null when the size is invalid or memory runs out.

memory := cast(*u8) allocator_proc(.ALLOCATE, 8, 0, null, null);
memset(memory, 7, 8);
grown := cast(*u8) allocator_proc(.RESIZE, 64, 8, memory, null);
assert(grown[7] == 7);
allocator_proc(.FREE, 0, 64, grown, null);
↗

Types#

Temporary_Storagestructsince 0.31.0Source
:: struct
data: *u8
size: s64
total_bytes_occupied: s64
high_water_mark: s64
last_set_mark_location: Source_Code_Location
implementation_data: [256] u8

Constants#

OS_IS_UNIXsince 0.31.0Source
:: OS == .MACOS || OS == .LINUX || OS == .PS5 || OS == .IOS || OS == .ANDROID