Reading some x11 protocol code and code was pretty weird by modern standards … like, it’s mostly just writing a struct literally from memory…. Cast that lil struct to a void pointer and write it out on the socket;
@whack yep, that’s what everyone was doing really… Python has struct (https://docs.python.org/3/library/struct.html) and Perl has pack/unpack (https://perldoc.perl.org/functions/pack) literally to interop with this kind of protocols
struct — Interpret bytes as packed binary data

Source code: Lib/struct.py This module converts between Python values and C structs represented as Python bytes objects. Compact format strings describe the intended conversions to/from Python valu...

Python documentation