HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
taviso
ctypes.sh
C2015–2026
taviso / ctypes.sh

ctypes.sh

A foreign function interface for bash.

23Distinct people
30Mentions
0Explicit recommenders
2.2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A foreign function interface for bash.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year30 dated mentions

Observed mentions: 2015-07-28 03:56:59 UTC to 2026-06-20 21:04:24 UTC.

024682015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 2 mentions; 2 submissions, 0 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 3 mentions; 2 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 4 mentions; 3 submissions, 1 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 2 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 8 mentions; 2 submissions, 6 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC220
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC413
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC321
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC303
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC431
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC321
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC826
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC000
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
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 / libdw (optional) Fedora For recent Fedora, this should be enough: sudo yum install elfutils-devel dnf-utils Now you can use the debuginfo-install command to install debugging symbols for automatic structure support. Ubuntu For recent Ubuntu, this should be enough: sudo apt install autoconf libltdl-dev libffi-dev libelf-dev elfutils libdw-dev pkg-config If you want to use automatic struct support (recommended), you should also make you have ddebs available. 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 Cthulhu." You can read more about ctypes.sh and see it in action on the Wiki
Read the full README on GitHub

What Hacker News says

30 sources
Guess streams was a mixed analog / digital world thing[0]. Is 'curl' the higher order wave crest of LC_NETWORK (aka 'sane' http protocol reference to type bundled 0,1,2 file descriptors) One can have curl as a bash loadable routine without the need to recompile bash. Headless or not, much more sane[4] than ctypes.sh[1] as curl binary epilog/prolog handle the non-http protocol items within the context of curl module/program. More relevant logic level related to topic beyond http protocol only curl : socat[2] and gnu netcat[3]. Ah, HN doesn't provide a way to conjure up * data tapes (comments not withstanding). Ebnf being battle tested for years & grepping the ANTLER[7] by the horns: awk interpeting http stream via http protocol[5] via ebnf of http protocol likely to better handle the different protocal layers more gracefully than bash
Read the rest
script. Would need to make sure awk is in bit mode and not character/byte mode to avoid line discipline issues / 'stty sane'[4]. Note: Perl/python provide better layers of abstraction than shell coding for the different levels of protocols used in/with http protocol/ ebnf,Kleene* coding.[6] In shell, having a different command programm for every ebnf set/protocol level vs. awk, different ebnf for each Kleene* protocol level) --------------------------------------------------------------------------------------------- [0] : Your trerminal is not a terminal: An Introduction to Streams : https://www.lucasfcosta.com/blog/streams-introduction [1] : ctypes.sh : https://github.com/taviso/ctypes.sh [2] : socat : https://github.com/3ndG4me/socat/releases [3] : gnu netcat: https://netcat.sourceforge.net/ [4] : stty sane : https://real-world-systems.com/docs/stty.1.html https://jaredgorski.org/notes/unix-tty/ [5] : https://www.rfc-editor.org/rfc/rfc9110.pdf [6] : https://grokipedia.com/page/Kleene_star [7] : https://en.wikipedia.org/wiki/ANTLR
In TIL: You can make HTTP requests without curl using Bash /dev/TCP
So, the game is written in bash much like AI stuff is written in Python. The heavy lifting is done by a native-code library, while the bash code provides the glue and the overall control logic. (Much like having heavy lifting done by PyTorch with Python code providing general guidance.) And this is completely fine, to my mind. Bash is intended to be a glue language orchestrating execution of native code. Usually it starts processes, but here it interacts with a native-code library. See: https://github.com/taviso/ctypes.sh/ https://github.com/raysan5/raylib
In A bullet hell game written in bash

Showing the 15 most recent of 30 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.