> a general equivalent to the C++ `extern "C" { ... }` thing

That sounds a lot like what LuaJIT’s FFI provides: https://luajit.org/ext_ffi.html

Oh awesome, thanks for the pointer!