GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SNOBOL4FFI(3) CSNOBOL4 Manual SNOBOL4FFI(3)

snobol4ffi - Foreign Function Interface for SNOBOL4


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

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().

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

Philip L. Budne
Inspired by an FFI interface by Fred Weigel
March 31, 2022 CSNOBOL4B 2.3.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.