

GitHub - taviso/ctypes.sh: A foreign function interface for bash.
source link: https://github.com/taviso/ctypes.sh
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
ctypes.sh
This is ctypes.sh
, a foreign function interface for bash.
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 use
GTK+ natively in
your shell scripts, or write a high-performance http daemon.
See more examples here
prerequisites
ctypes.sh
is dependent on the following libraries and programs:
- libffi
- bash
- libelf (optional)
- elfutils (optional)
- libdwarf (optional)
install
ctypes.sh
can be installed from source like this:
$ git clone https://github.com/taviso/ctypes.sh.git
$ cd ctypes.sh
$ ./autogen.sh
$ ./configure
$ make
$ [sudo] make install
By default ctypes.sh
is installed into /usr/local/bin
and
/usr/local/lib
. You can overload the prefix path by defining the
PREFIX
environment variable before installing.
$ PREFIX=$HOME make install
example
source ctypes.sh puts () { dlcall puts "$@" return $? } puts "hello, world"
Here is what people have been saying about ctypes.sh:
- "that's disgusting"
- "this has got to stop"
- "you've gone too far with this"
- "is this a joke?"
- "I never knew the c could stand for Cthulu."
You can read more about ctypes.sh and see it in action on the Wiki
Recommend
-
65
README.md FFI PHP extension (Foreign Function Interface) FFI PHP extension provides a simple way to call native functions, access native variables and create/access data structures defined in C...
-
44
README.md Status
-
23
How to convert ctypes' c_long to int of Python? advertisements int(c_long(1)) doesn't work. >>&g...
-
9
Copy link Contributor hyd-dev commented...
-
7
nntpit This is a simple reddit2nntp gateway server that lets you use a newsreader to follow discussions on reddit. The intention is for you to run it locally, tell your newsreader to connect to localhost, and subreddits will appear a...
-
14
How can I pass null * array to a C function via ctypes? advertisements I have a C function in a dll file defined as follows: my...
-
8
Python 3.X ctypes 和 greenlet size changed 坑三则 Posted 2021-12-01 | stdout 安装 setup.py 的时候 No module named '_ctypes' 报错 Traceback (most recent call last): File "...
-
9
Lotus 1-2-3 for Linux This is a native port of Lotus 1-2-3 Release 3 to Linux. This is possible because Lotus 1-2-3 for UNIX SystemV used a trick called
-
14
WordPerfect for UNIX Character Terminals This is a set of build scripts and patches to make WordPerfect for UNIX (Released 1997) work on modern Linux. You need the following file to build this, available
-
13
Conversation Member Fixes
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK