It's a funny trick, but you could probably also use setjmp and longjmp with ctypes.sh :-)
rundll32.exe is just a way of doing FFI from as a command -- there are few different options on UNIX-likr systems for that. The most obvious is ctypes.sh [0].
There are, though, even more sophisticated options than just FFI, like the Witchcraft Compiler Collection [1], which includes among other things an interactive shell.
If you want that same ability from bash, it's available [0]. However, it interacts with C FFI, so it's lower level.
This is a great list. Also while reading about 'readonly' bash variables I ran across this amazing project which lets you call native functions from bash [0]. My mind is spinning from the possibilities...
> Can you integrate C extensions into bash with SWIG, or any other way short or recompiling?
Yes[1], although I don't recommend doing that. See my longer comment[2] re: bash is a simple scripting/glue language, not a general-purpose programming tool.