Skip to content

Latest commit

 

History

History
72 lines (58 loc) · 2.34 KB

FFI.md

File metadata and controls

72 lines (58 loc) · 2.34 KB

CL-Forth Foreign Function Interface (FFI)

CL-Forth includes a foreign function interface (FFI) loosely based on the External Library Interface in SwiftForth.

TO BE SUPPLIED

FFI Examples

The file time-sample.4th uses xlibrary and function: to define gettimeofday, time, and localtime_r words which invoke the corresponding C functions. It then uses those words and appropriate structure definitions to define two words, timeofday and localtime, to print the results of calling those functions.

? (forth:run)
CL-Forth Version 1.3
Running under SBCL 2.4.7
include examples/time-sample.4th
OK.
timeofday
Time = 1724872035.919477
TZ = 300 (DST)
OK.
localtime
Local time is Wednesday, 28 August 2024 15:07:18 EDT
OK.
bye
In this session:
  25 definitions created
  74432 bytes of object code generated