J E L L Y E N T
Ctypes.sh: A foreign attribute interface for bash

Honest here’s ctypes.sh, a foreign attribute interface for bash.

ctypes.sh is a bash plugin that affords a foreign attribute interface in an instantaneous
in your shell. In assorted phrases, it permits you to name routines in shared
libraries from within bash.

A (very) easy event can lend a hand illustrate:

$ dlcall areas "hello, world"
hello, world

# A extra advanced event, dissipate libm to calculate sin(PI/2)
$ dlopen libm.so.6
0x172ebf0
$ dlcall -r double sin double:1.57079632679489661923
double:1.000000

ctypes.sh can lengthen bash scripts to manufacture initiatives that were beforehand
now no longer reputedly, or would require exterior helpers to be written.

ctypes.sh makes it reputedly to dissipate
GTK+ natively in
your shell scripts, or write a high-performance http daemon.

Uncover extra examples here

wish to haves

ctypes.sh relies on the following libraries and applications:

  • libffi
  • bash
  • libelf (non-compulsory)
  • elfutils (non-compulsory)
  • libdwarf / libdw (non-compulsory)

Fedora

For up-to-the-minute Fedora, that is in most cases sufficient:

sudo yum install elfutils-devel dnf-utils

Now it’s doubtless you’ll well presumably also perchance dissipate the debuginfo-install checklist to put in debugging symbols for automated building toughen.

Ubuntu

For up-to-the-minute Ubuntu, that is in most cases sufficient:

sudo beautiful install autoconf libltdl-dev libffi-dev libelf-dev elfutils libdw-dev

In repeat so as that you simply appropriate can dissipate automated struct toughen (told), it’s doubtless you’ll well presumably also perchance neatly also scheme
you luxuriate in ddebs on hand.

install

ctypes.sh is in most cases installed from offer love this:

$ git clone https://github.com/taviso/ctypes.sh.git
$ cd ctypes.sh
$ ./autogen.sh
$ ./configure
$ scheme
$ [sudo] scheme install

By default ctypes.sh is installed into /usr/native/bin and
/usr/native/lib. It’s doubtless you’ll well presumably also overload the prefix route by defining the
PREFIX atmosphere variable sooner than installing.

$ PREFIX=$HOME scheme install

event

offer ctypes.sh
areas () {
  dlcall areas "$@"
  return $?
}

areas "hello, world"

Honest here’s what of us had been affirming about ctypes.sh:

  • « that is disgusting »
  • « this has obtained to discontinuance »
  • « it’s doubtless you’ll well presumably also perchance luxuriate in long long previous too some distance with this »
  • « is that this a shaggy dog story? »
  • « I never knew the c can also perchance stand for Cthulhu. »

It’s doubtless you’ll well presumably also be taught extra about ctypes.sh and search for it in motion on the Wiki

Learn More

3 Commentaires

Leave a Comment

Recent Posts

An oil tanker with 60M gallons of oil aboard is all thru the meantime sinking [video]
Amazon’s $23M book about flies (2011)
Google Coral Dev Board mini SBC is now on hand for $100
Glow: Markdown reader for the terminal with a TUI and encrypted cloud stash
The manner you would possibly well abolish your occupation, one entirely extremely contented one year at a time

Recent Posts

An oil tanker with 60M gallons of oil aboard is all thru the meantime sinking [video]
Amazon’s $23M book about flies (2011)
Google Coral Dev Board mini SBC is now on hand for $100
Glow: Markdown reader for the terminal with a TUI and encrypted cloud stash
The manner you would possibly well abolish your occupation, one entirely extremely contented one year at a time
fr_FRFrench
en_USEnglish fr_FRFrench