dlcall(1)

dlcall(1) General Commands Manual dlcall(1)

NAME

dlcall - lets you call C library functions from the command line

SYNTAX

dlcall [library] function arguments...

DESCRIPTION

The first argument is either a function name or the dynamic library to load the function from. All subsequent arguments describe the arguments and function prototype.
Arguments that parse as ints are assumed to be ints, as doubles assumed to be doubles, and otherwise treated as strings. The default can be overridden with
-s 1 string "1"
-i 1 int 1
-c 1 char '1'
-d 1 double 1.0

Return types are assumed to be double for functions taking a double and int otherwise. The return type can be specified with -r X, for X one of the characters sicd above.
For functions from arbitrary libraries, give the path to the dynamic library before the function name with LD_PRELOAD=</path/to/library>.
dlcall only understands certain function prototypes currently, including most string and math functions. Pull requests are welcome to add more functions.

OPTIONS

-s ARG ARG is a string argument
-i ARG ARG is an int argument
-c ARG ARG is a char argument
-d ARG ARG is a double argument
-r [sicd] function returns string, int, char, or double
-v Enable verbose logging

ENVIRONMENT VARIABLES

LD_PRELOAD=library Preload library the usual way, so dlopen(3) can call a function from it.

EXAMPLES

dlcall sin 2.5
dlcall strlen "hello world"
dlcall strcasecmp hello HELLO
dlcall strchr world -c r -r s
dlcall getenv HOME -r s
dlcall write 1 hello 5
dlcall isalpha -c 6

AUTHORS

Michael Homer https://michael.homer.nz/

SEE ALSO

dlopen(3)

0.0.0 Michael Homer