Talk Abstract: Modern systems often lose safety guarantees at FFI boundaries when interfacing with C-based APIs. This talk presents systematic techniques for extending compile-time safety across API borders using typestate patterns and static type systems. Using TypeSec—a Rust framework for OpenCL GPU APIs—as a concrete example, I will demonstrate how phantom types and linear event tokens embed complex host-side protocols into the compiler’s type checker, preventing runtime errors before execution. Live demos will show compile-time detection of incorrect buffer sequences and forgotten synchronization, while performance benchmarks confirm zero-cost abstractions. Building on TypeSec, I will outline a general methodology for constructing end-to-end safety chains that span application logic through hardware interfaces. We will discuss how to adapt these patterns to other APIs such as CUDA and Vulkan and how to integrate them into defense-in-depth architectures for heterogeneous computing. Audience: Systems developers and researchers seeking robust, compile-time–enforced safety in heterogeneous and FFI-driven environments.