Sanko
Robinson

I design and implement , , and the infrastructure that powers them. I also maintain several and systems utilities.

My work spans the full stack: from lexers and in the frontend, through intermediate representations, to register allocation and .

Currently focused on and verified code generation.

2026

Parataxis, Eventually

Game loops, polling mechanics ("send a heartbeat ping every 5 seconds"), and API integrations ("only make 10 API requests per second to Stripe") requi...

Parataxis in the Not Too Distant Future

I'm still planning and framing things out but I have further ideas. I'm still digging into distributed and concurrent systems like Erlang/OTP, Clojure...

Parataxis in the Near Future

I've been looking at other concurrency systems as I tinker and I am determined to bring what I've found to this project. No more introduction, let me...

xmake as a Build Back-End for Perl + C Projects

If your Perl distribution contains C code that needs to be compiled (an .xs extension, a helper tool, or a shared library for FFI) you have traditiona...

Just-in-Time API Generation

We've spent the previous 50 chapters binding to existing C libraries or writing our own static extensions. For the grand finale, we'll look at the ult...

Cross-Compiling with Zig CC

Developing on Linux but need to test a Windows .dll? Zig ships a single toolchain that can cross-compile for any target, and Affix::Build speaks Zig n...

C++ VTables and ThisCall Integration

In previous chapters, we bypassed C++ name mangling and wrapper shims by manually ripping the Virtual Method Table (vtable) out of a C++ object and ca...

The "Universal Object" Pattern

In previous chapters, we hacked a C++ vtable and learned to use ThisCall to pass the object context smoothly. Now, we're going to combine those techni...

Emulating Native 128-bit Integers in Perl

Modern system programming frequently requires numbers larger than 64 bits. IPv6 addresses, UUIDs, cryptography algorithms, and specialized high-precis...

Dealing with Flexible Array Members (FAM)

C99 introduced flexible array members, which allow structure to end with an array of unspecified size. This is a common pattern for packets of data w...

N-Dimensional Arrays & Tensors

Standard FFI examples usually show 1D arrays (a list of numbers). But real-world data like images, matrices, and physics grids are often N-dimensional...

Hardware Registers and Bitfield Packing

In embedded systems, binary file formats, and network protocols, space is at a premium. Instead of using a whole int for a boolean flag, programmers o...

Cooperative Fibers in FFI

As you likely know, Perl 5 is fundamentally single threaded. While threads.pm allows for concurrency, it creates "heavy" threads that clone the entire...

Performance Optimization with Memory Arenas

Frequent calls to malloc() and free() (or Perl's new and garbage collection) can become a significant bottleneck in performance-critical code. Each al...

FFI in a Multithreaded System

Perl's threads.pm implements "heavy" threads, where each thread is a complete clone of the interpreter. While this model provides excellent isolation,...

C++ Exception Unwinding

I've put it off for months but now have unit tests that sorta kinda demonstrates it. [Edit: I have no roadmap or timeline but] I'll need to come back...

The Zero-Dependency Image Processor

For our next trick, we'll tackle the most common headache in the C ecosystem: Dependency Hell. Usually, if you want to manipulate images, you need lib...

SIMD Vectors for Number Crunching

Standard Perl scalars are designed for flexibility, not raw math throughput. When you need to process millions of coordinates, pixels, or audio sample...

SIMD and Matrix Benchmarks

So, you read previous chapters on this same topic, but the ultimate question remains: "Is it fast?"...

Wrapping C Classes by Hacking Vtables

In a previous chapter, we wrapped C++ classes using extern "C" helper functions in a shim. That is the 'Right Way.' But what if you are stuck with a p...

Wrapping C Classes with C Shims

C++ libraries are notoriously difficult for FFI systems to bind. Unlike C, which uses standard symbol names, C++ "mangles" function names (for example...

An Affix Module Factory

While runtime wrapping is convenient, it has a startup cost (parsing headers every time). For a distributable CPAN module, you want the parsing to hap...

Instant Runtime Wrappers

The fastest way to use Affix::Wrap is runtime wrapping. In this workflow, you parse the headers and bind the functions immediately when your script st...

Automated Introspection with Affix Wrap

Writing affix signatures manually is great for control, but it becomes tedious when wrapping a library with hundreds of functions and structs. Instead...

2025

The Kitchen Sink Polyglot Library

Sometimes, the best tool for the job involves three different tools. You might have legacy math models in Fortran, performance-critical loops in Assem...

Perl Callbacks in C Structs vtables

In C, OOP is often simulated using structs containing function pointers. This pattern is commonly known as a vtable and allows a library to call diffe...

Troubleshooting Debugging

When things go wrong in Perl, you probably get an error message. When they go wrong in C, you get a segfault, a frozen terminal, or data corruption th...

Error Handling

System calls fail. In C, you check the global errno variable (or GetLastError() on Windows). In Affix, we expose this via errno()....

Advanced File Handling

Bridging I/O between languages is historically one of the most fragile aspects of FFI. While handling file descriptors manually as opaque pointers may...

Direct Marshalling Trampolines

Speed is the reason I wrote infix and Affix and I think I've achieved a good balance of features vs. speed. I've done a lot of work to reduce overhead...

Smart Enums

C headers are full of enum definitions. To the C compiler, these are just integers. To the programmer, they have semantic meaning. When binding these...

Callbacks Context Closures

In a previous chapter, we passed a simple callback. But real-world C libraries often take a callback and an opaque pointer (usually something like voi...

Transparent Structs

Sometimes you need to peek inside the oven. If a function expects a C style struct to be passed by value or if you want to read struct members without...

Callbacks

C libraries often use callback functions to delegate logic back to the user. The standard library's qsort is the classic example: it knows how to sort...

Variadic Functions

Some C functions don't have a fixed number of arguments. The most famous example is printf, which takes a format string and... almost everything else....

Mutable Arrays

In C, arrays passed to functions are often used as output buffers. The function reads data from the array, modifies it in place, and expects the calle...

Arrays vs Pointers

In C, arrays and pointers are cousins. In function arguments, they are twins. Declaring void func(int a[]) is exactly the same as void func(int *a). H...

System Libraries on Linux

Perl scripts often live in the terminal or deep inside a server handing out webpages or whatnot, but they don't have to stay there. Earlier, in chapte...

Manual Memory Management

Perl handles memory for you. C does not. When you start allocating raw memory buffers in Affix, you are stepping into the C world. This recipe demonst...

Opaque Pointers

Affix cannot directly instantiate a C++ class or read a C struct unless we define every single field with the correct type and in the proper order. Of...

The Standard Library

Every operating system comes with a "C standard library" or, simply, libc. It contains the fundamental building blocks of C programming: memory alloca...

Strings and Static State

Dealing with C strings usually involves asking "Who owns this memory?"...

Binary Data and the Null Byte Trap

C strings are simple: they start at a memory address and end at the first zero/null byte (\0). But what if your data contains nulls? If you use standa...

Speaking Windows

When interacting with the Windows API (Win32), you will inevitably face two facts: libraries are named things like user32.dll, and text is almost alwa...

The Instant C Library

Sometimes, you don't have a pre-existing .dll or .so file. Sometimes, you just have an idea, a heavy mathematical loop, or a snippet of C code you fou...

Welcome to the Affix Cookbook

Welcome to the Affix Cookbook! This guide is a living collection of recipes, techniques, and architectural patterns for mastering Foreign Function Int...

Packed Trampolines

We have nearly reached the end of the current roadmap. infix is fast, secure, and portable. But optimization is an addiction, and I am already looking...

Language Specific Trampolines

This is an explanation and expansion of discussion #26 now that I've started actually implemented and designed my idea....

System calls via FFI

I've had this idea for a while now and might put effort into it next. I understand that this would be a massive task but the first 30% of it is alread...

2024

Todo list

Features I'd love to include when I have the time will find their way here....