guile-user
[Top][All Lists]
Advanced

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

Trouble with returning parameters passed in to C primitives.


From: Richard Shann
Subject: Trouble with returning parameters passed in to C primitives.
Date: Thu, 06 Dec 2012 11:20:36 +0000

In GNU/Denemo we have been calling functions written in C from scheme by
defining procedures via scm_c_define_gsubr. Recently I have tried
returning one of the parameters passed (more exactly, the scm_list_ref
of a scm_car() of one of the parameters) and I have run into trouble.
If I pass 'a in as a parameter I get something back which prints on the
console as (quote a) but which is not eq? to 'a

I can pass in a string and get an equal? string back. But what I really
want to do is pass in a procedure and execute it if I get it back, thus

(set! choice (d-PopupMenu (list '("Offset Position" . do-offset))))
(if choice
 (choice))

where do-offset is defined as (define (do-offset) (display "hello world"))
and d-PopupMenu is my C-primitive which gets a choice from the user. 

If the user cancels choice is #f and all is well, if he accepts the one
option on the menu, do-offset is returned but I get the error message

(#f Wrong type to apply: ~S (do-offset) #f)

(BTW I can't find a blow by blow explanation of this error message
anywhere, I see some discussion of earlier versions of it on the net...)

Anyone able to help?

Richard Shann





reply via email to

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