ui/objc_mac
lib/ui/objc_mac.vklib/ui/objc_mac.vk
Pure-Veko Objective-C runtime (libobjc.A.dylib) & macOS framework bridge (ui/objc_mac).
- Zero top-level mut globals: all handles, caches, and delegates live inside ObjcRuntime
- Direct ffi/* builtins (no use [ffi]), operating under allow-caps = [.ui]
- Deterministic headless fallback when VEKO_HEADLESS=1 or AppKit is unavailable
ObjcRuntime = struct { headless bool = ..., lib_objc i64 = ..., lib_appkit i64 = ..., lib_foundation i64 = ..., lib_cf i64 = ..., lib_cg i64 = ..., lib_webkit i64 = ..., lib_un i64 = ..., lib_carbon i64 = ..., fn_get_class i64 = ..., fn_sel_reg i64 = ..., fn_msg_send i64 = ..., fn_alloc_cls i64 = ..., fn_add_method i64 = ..., fn_reg_cls i64 = ..., fn_pool_push i64 = ..., fn_pool_pop i64 = ..., fn_cf_rl_main i64 = ..., fn_cf_rl_wake i64 = ..., cls_cache map = ..., sel_cache map = ..., delegate_cls i64 = ..., delegate_obj i64 = ... }
mac-headless-env? = fn [] bool
objc-cls = fn [mut rt ObjcRuntime, name str] i64
Resolves and caches an Objective-C Class pointer by name (0 when headless or missing).
objc-sel = fn [mut rt ObjcRuntime, name str] i64
Registers and caches an Objective-C SEL pointer by name (0 when headless or missing).
msg0 = fn [mut rt ObjcRuntime, obj i64, sel_name str] i64
msg1 = fn [mut rt ObjcRuntime, obj i64, sel_name str, a1 any] i64
msg2 = fn [mut rt ObjcRuntime, obj i64, sel_name str, a1 any, a2 any] i64
msg3 = fn [mut rt ObjcRuntime, obj i64, sel_name str, a1 any, a2 any, a3 any] i64
msg4 = fn [mut rt ObjcRuntime, obj i64, sel_name str, a1 any, a2 any, a3 any, a4 any] i64
msg5 = fn [mut rt ObjcRuntime, obj i64, sel_name str, a1 any, a2 any, a3 any, a4 any, a5 any] i64
msg-rect = fn [mut rt ObjcRuntime, obj i64, sel_name str, x i64, y i64, w i64, h i64] i64
Dispatches objc_msgSend(obj, sel, (as-f64 x), (as-f64 y), (as-f64 w), (as-f64 h)) (NSRect in d0..d3).
msg-init-win = fn [mut rt ObjcRuntime, win_alloc i64, x i64, y i64, w i64, h i64, style_mask i64, backing i64, defer_flag i64] i64
Dispatches -[NSWindow initWithContentRect:styleMask:backing:defer:].
msg-set-f64 = fn [mut rt ObjcRuntime, obj i64, sel_name str, val f64] i64
Dispatches a single f64 (CGFloat / double) argument to obj.
ns-str = fn [mut rt ObjcRuntime, s str] i64
Creates an autoreleased NSString* from a Veko UTF-8 str.
from-ns-str = fn [mut rt ObjcRuntime, ns_s i64] str
Reads a NSString* via UTF8String into a plain Veko str.
from-ns-str-secret = fn [mut rt ObjcRuntime, ns_s i64] secret str
Reads a NSString* directly into a .secret slab (bytes/with-secret 0) without creating a plain str.
objc-init = fn [headless bool] ObjcRuntime
Initializes ObjcRuntime, loads macOS frameworks, and registers VekoActionDelegate.
objc-pool-push = fn [rt ObjcRuntime] i64
objc-pool-pop = fn [rt ObjcRuntime, pool i64]
cf-wake-addr = fn [rt ObjcRuntime] i64
cf-wake-main = fn [rt ObjcRuntime]
objc-shutdown = fn [mut rt ObjcRuntime]
Releases loaded Objective-C / AppKit framework handles and resets rt.