[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] FFI Question

From: Heath Johns
Subject: [Chicken-users] FFI Question
Date: Wed, 3 May 2006 22:35:56 -0700

Hey there, nice scheme you've got here folks :)

I've got a noob question: Why does this segfault?  Should I be doing
this differently?  I'm using 2.3 stable on linux...


char* nothing();

void bob()
   printf("%p\n", nothing());

(foreign-safe-wrapper c-string "nothing" ()
 (lambda () #f))

((foreign-safe-lambda void "bob"))


For context's sake, I (like the fellow not so long ago) am extending
the readline support.  I've got paren bouncing working perfectly, now
I'm on to tab-completion.  I can't seem to send a NULL back from the
completion callback function without it crashing (sending a string
works fine).

Also, I think I may have found an unrelated bug.  It seems that the
optimizer takes out arguments from lambdas if they're not being used,
and this doesn't agree with callbacks.  I was using
foreign-safe-wrapper like so:


(foreign-safe-wrapper void "zoot" (int int)
 (lambda (one two)
   (display one)))


And whenever I tried to call zoot from C I'd get "Error: bad argument
count - received 2 but expected 1: #<procedure>".  Works fine if you
put a (display two) in there though.

I see that there is a very similar bug in the changelog at Mon Jan 24
20:55:07 CET 2005 for version 2.2.  It seems likely that they are

Heath Johns

reply via email to

[Prev in Thread] Current Thread [Next in Thread]