SNOBOL4FFI(3)

πŸ“¦
version 2.3.5 Β· 2 versions
, in nixpkgs unstable

πŸ’… SNOBOL4FFI πŸ’…

okay so this is from the CSNOBOL4 Manual, and bestie, it's literally the page that lets your SNOBOL4 code reach out and touch actual C libraries. Foreign Function Interface energy. no cap.


✨ NAME ✨

snobol4ffi β€” the Foreign Function Interface for SNOBOL4. yes queen, your interpreter can call external functions now 🫢


🌸 SYNOPSYS 🌸

-INCLUDE 'ffi.sno'
        dl = FFI_DLOPEN("/usr/lib/libm.so")
        sym = FFI_DLSYM(dl, "hypot")
        DEFINE_FFI("hypot(double,double)double", sym)
        OUTPUT = hypot(3, 4)

like, that's the whole vibe. include the file, open the lib, grab the symbol, define the function, call it. iconic four-step. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

Three little functions that make the magic happen. here's the tea:

  • FFI_DLOPEN(filename) β€” you hand it the path of a dynamically loadable executable file, and it hands you back a value. keep that value safe, because it's the thing you pass to FFI_DLSYM(). ✨
  • FFI_DLSYM(library,function) β€” takes a library value that came back from FFI_DLOPEN(), plus a function name, and gives you back a value that you can pass straight into DEFINE_FFI(). it's giving matchmaker, lowkey. 🌸
  • DEFINE_FFI(prototype,pointer) β€” this is the main character. it defines a SNOBOL4 function that calls an external function via ffi(3). prototype holds a string name for the function, followed by a comma separated list of parameter types inside of parentheses β€” any of: sint8, sint16, sint32, sint64, uint8, uint16, uint32, uint64, schar, sshort, sint, slong, uchar, ushort, uint, ulong, float, double, longdouble, pointer β€” and then a return type, which can be any of the above parameter types, or void, string, freestring. pointer is a value returned by FFI_DLSYM(). πŸ”₯
fr fr though, get that type list right β€” every single one of those names matters, so don't be out here freestyling. 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

snobol4(1), ffi(3), dlopen(3) β€” go read those too, bestie, they're the supporting cast πŸ’–


🌈 AUTHOR 🌈

Philip L. Budne β€” king behavior. πŸ‘‘

Inspired by an FFI interface by Fred Weigel ✨


okay that's the whole page, slay. πŸ¦‹ this cutie is from CSNOBOL4B 2.3.5, dated October 18, 2026 β€” literally stamped and everything. πŸ’œπŸ§š

πŸ“¦ where this page comes from