ctypes.sh

A foreign function interface for bash.

View the Project on GitHub taviso/ctypes.sh

Welcome to ctypes.sh

ctypes.sh is a bash plugin that provides a foreign function interface directly in your shell. In other words, it allows you to call routines in shared libraries from within bash.

A (very) simple example will help illustrate:

$ dlcall puts "hello, world"
hello, world

# A more complex example, use libm to calculate sin(PI/2)
$ dlopen libm.so.6
0x172ebf0
$ dlcall -r double sin double:1.57079632679489661923
double:1.000000

ctypes.sh can extend bash scripts to accomplish tasks that were previously impossible, or would require external helpers to be written. ctypes.sh makes it possible to call standard library functions, or even use GTK+ from your shell scipts.

See more examples here

Documentation for ctypes.sh is available on the wiki