I'm so happy I could cry after being on a roller coaster
of trying to figure this out.
I came close to bailing a few times.


van:~/code/scm/cev$ ./main.exe add
add-event...
f:0x92ee931d220
cb2 (defined in scheme, and called in C)
cb_func_2 called 1 times.
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
cb2 (defined in scheme, and called in C)
^C



This is the libevent C library on OpenBSD ...
...
calling into scheme functions.
That output is from scheme code.
The libevent library is C and takes callbacks to
do it's event triggered stuff.
I defined a C compatible callback from scheme code.

I added an event callback that fires every second.
So that means libevent is running and every second
it executes a callback function that is written in scheme.

:)

This means I can do high level scheme stuff, and use
the low level libevent lib.
(I assume this would work with any C event lib like libev
or libuv, but as an OpenBSD zealout for the time
being I am using the one sanctioned by them.)

#openbsd #scheme #chicken #libevent