# SNOBOL4FFI(3) | CSNOBOL4B 2.3.2 | Janurary 1, 2024

## NAME

snobol4ffi – Foreign Function Interface for SNOBOL4

## 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)

## DESCRIPTION

FFI_DLOPEN(filename)
  takes the path of a dynamicly loadable executable file and returns a value which can be passed to FFI_DLSYM().

FFI_DLSYM(library,function)
  takes a library value returned by FFI_DLOPEN(), and a function name, and returns a value which can be passed to DEFINE_FFI().

DEFINE_FFI(prototype,pointer)
  defines a SNOBOL4 function that calls an external function via ffi(3). prototype contains a string name for the function followed by a comma separated list of parameter types inside of parenthesis (any of: sint8, sint16, sint32, sint64, uint8, uint16, uint32, uint64, schar, sshort, sint, slong, uchar, ushort, uint, ulong, float, double, longdouble, pointer), followed by a return type, which can be any of the above parameter types, or void, string, freestring. pointer is a value returned by FFI_DLSYM().

## SEE ALSO

snobol4(1), ffi(3), dlopen(3)

## AUTHOR

Philip L. Budne
Inspired by an FFI interface by Fred Weigel