Ctypes.sh – A foreign function interface for bash
1–10 of 39 posts
Re: Ctypes.sh – A foreign function interface for bash
#2All sarcasm aside, a very interesting idea. I'm not sure what the proper use case is, but I'm sure someone will love this.
Re: Ctypes.sh – A foreign function interface for bash
#3What could go wrong? /s All sarcasm aside, a very interesting idea. I'm not sure what the proper use case is, but I'm sure someone will love this.
Re: Ctypes.sh – A foreign function interface for bash
#4What could go wrong? /s All sarcasm aside, a very interesting idea. I'm not sure what the proper use case is, but I'm sure someone will love this.
That said, unshare(1) now supports `-r` with `-U`, which was the thing I needed.
Re: Ctypes.sh – A foreign function interface for bash
#5I initially wrote it basically just for giggles, but was rather pleased a few months ago when I realized I could use it for something I actually needed, and it was just the right thing (presenting a mount point that acted as a view of the differences between two rsnapshot-style hard-link trees -- only took a few dozen lines of very simple code).
Re: Ctypes.sh – A foreign function interface for bash
#6What could go wrong? /s All sarcasm aside, a very interesting idea. I'm not sure what the proper use case is, but I'm sure someone will love this.
The best use-case I can think of is using bash as a REPL for C libraries. Many times in the past, I've made library calls that either misinterpreted the parameters or the result value. I would have loved the ability to prototype those calls in bash until I understood them enough to call them properly.
Re: Ctypes.sh – A foreign function interface for bash
#7Re: Ctypes.sh – A foreign function interface for bash
#8Earlier quoted context omitted.
The best use-case I can think of is using bash as a REPL for C libraries. Many times in the past, I've made library calls that either misinterpreted the parameters or the result value. I would have loved the ability to prototype those calls in bash until I understood them enough to call them properly.
You can use gdb as an REPL for C.
Edit: I suppose it is possible to get some version of a repl with C++ (Cling?), Java (Beanshell, Java 9?), C# (Mono, but not currently .Net?). But each of those seems generally a bit harder to get access to than simply calling gdb on a binary with debugging symbols enabled.
Re: Ctypes.sh – A foreign function interface for bash
#9Earlier quoted context omitted.
The best use-case I can think of is using bash as a REPL for C libraries. Many times in the past, I've made library calls that either misinterpreted the parameters or the result value. I would have loved the ability to prototype those calls in bash until I understood them enough to call them properly.
You can use gdb as an REPL for C.
Re: Ctypes.sh – A foreign function interface for bash
#10Earlier quoted context omitted.
You can use gdb as an REPL for C.
My gdb-fu is weak, but don't you have to have a binary that you're debugging to do that? I'm thinking of this as more of an exploratory thing-- poking around the edges of an API until I feel comfortable enough with it to start writing real code.
#include
int main() { return 0; }