Callback with 'local' lambda?

9 views
Skip to first unread message

Johannes Kroll

unread,
Oct 23, 2016, 2:22:24 PM10/23/16
to Extempore
Hi,

Running the following code:

(bind-func do_callback
(let ((mycallback (lambda ()
(println "callback lamba called"))))
(lambda ()
(callback (now) mycallback))))

(do_callback)

Produces this:

Thread 22 "SP_task" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeccc4700 (LWP 23804)]
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00000000005dd4ad in extemp::SchemeProcess::taskImpl() ()
#2 0x00007ffff7bc16fa in start_thread (arg=0x7fffeccc4700) at pthread_create.c:333
#3 0x00007ffff68fdb5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb)

When I declare "mycallback" with bind-func, the callback works as
expected.

The stack trace looks as if a NULL function pointer is called?

Best,
J.

Andrew Sorensen

unread,
Oct 23, 2016, 2:23:58 PM10/23/16
to extemp...@googlegroups.com, Johannes Kroll
Callback only works with top lvl bindings
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Reply all
Reply to author
Forward
0 new messages