What does HackerNews think of ctypes.sh?

A foreign function interface for bash.

Language: C

It's a funny trick, but you could probably also use setjmp and longjmp with ctypes.sh :-)

https://github.com/taviso/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.

[0] https://github.com/taviso/ctypes.sh

[1] https://github.com/endrazine/wcc

If you want that same ability from bash, it's available [0]. However, it interacts with C FFI, so it's lower level.

[0] https://github.com/taviso/ctypes.sh

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...

[0]: https://github.com/taviso/ctypes.sh

> 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.

[1] https://github.com/taviso/ctypes.sh

[2] https://news.ycombinator.com/item?id=19951990