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 to this before I try to wrap the C++ based SFML with Affix.
Sanko Robinson
Human.
2026
C is often called "portable assembly," but sometimes you need the real thing.
If you are doing heavy scientific computing, you will eventually encounter Fortran (BLAS, LAPACK).
Perl is great for glue; Rust is great for logic.
In previous chapters, we compiled code directly or used Alien::Base to find system libraries. But sometimes you want a library that isn't installed on the system, isn't on CPAN, but is available in the wider C/C++ ecosystem.
**Full Changelog**: https://github.com/sanko/Alien-Xmake/compare/0.07...0.08
Allow users to define types in Affix::Wrap
Minor documentation tweaks
In the previous chapter, we built a script that compiles its own dependencies. To share this on CPAN, we want a standard module structure.
Based on infix v0.1.3
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 libpng, libjpeg, zlib, and headers for all of them installed on your system. If your user is on a different OS, your script fails. To avoid that, let's use Affix::Build to compile the famous stb single-header libraries.
**Full Changelog**: https://github.com/sanko/Alien-Xmake/compare/0.05...0.06
Standard Perl scalars are designed for flexibility, not raw math throughput. When you need to process millions of coordinates, pixels, or audio samples, you want SIMD (Single Instruction, Multiple Data).
In Chapter 30, 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 pre-compiled C++ library and can't recompile it? What if you're just super bored? Let's say you have an object pointer, but no C functions to pass it to.
C++ libraries are notoriously difficult for FFI systems to bind. Unlike C, which uses standard symbol names, C++ "mangles" function names (for example, turning Warrior::attack() into _ZN7Warrior6attackEv) to support features like overloading. Furthermore, C++ methods require a hidden this pointer to know which object instance they are acting upon.
While runtime wrapping is convenient, it has a startup cost (parsing headers every time). For a distributable CPAN module, you want the parsing to happen once (on your machine), generating a pure Perl module that users can load instantly.
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 starts. This is ideal for rapid prototyping, internal scripts, or testing, as you don't need to generate a separate .pm file.
Writing affix signatures manually is great for control, but it becomes tedious when wrapping a library with hundreds of functions and structs. Instead of staring at a .h file and manually translating C types to Affix types, let Affix::Wrap automate it!
2025
Sometimes, the best tool for the job involves three different tools. You might have legacy math models in Fortran, performance-critical loops in Assembly, and a clean C API to orchestrate them.
Throughout this cookbook, you've seen me use Affix::Build to generate shared libraries on the fly from C. However, building shared libraries isn't a concept limited to just C so neither are the capabilities of Affix::Build.
"Is Affix faster than... everything else?"
"Is Affix faster than pure Perl?"
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 different implementations of a function depending on the object it's holding. With Affix, you can populate these fields with Perl subroutines, effectively creating a Perl class that C can call into.
Manual free() is error-prone. We can use Perl's DESTROY phase to automate it.
This release contains real-world usage fixes since I'm using it in Affix.pm and not just experime...
This is the first public release of SDL3.pm, a pure Perl wrapper for SDL3.
**Full Changelog**: https://github.com/sanko/Affix.pm/compare/v1.0.0...v1.0.1
**Full Changelog**: https://github.com/sanko/Affix.pm/compare/v0.12.0...v1.0.0
## [0.1.2] - 2025-11-26
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 at the next bottleneck. The new direct marshalling API wins the benchmark races because it removes the intermediate step of packing C values into a buffer. Double indirection is slower than pulling them straight from the source SV*s.
This is an explanation and expansion of discussion #26 now that I've started actually implemented and designed my idea.
Really sanding down the rough edges this time around. This release includes significant ergonomic...
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 already accomplished by infix existing in its current state.
## [0.1.0] - 2025-10-27
Shower thought time... Internally, would it be faster to coerce args that would end up on the stack into a single block of malloc'd memory? Currently, our trampolines must perform a double-indirection to put data on the stack:
2023
Neat.