guile-user
[Top][All Lists]
Advanced

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

Re: Best way to call a user defined hook (written in guile) from C when


From: Andy Wingo
Subject: Re: Best way to call a user defined hook (written in guile) from C when the hook need plenty parameters
Date: Thu, 08 Jul 2010 20:51:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

On Mon 05 Jul 2010 21:18, Neil Jerram <address@hidden> writes:

> address@hidden writes:
>
>> (define (hook-helper %s) (lambda () #\t))
>>
>> where %s is the long list of parameters (foo bar baz...) that's inserted by 
>> the C program.
>> And :
>>
>> (define (hook . args) (local-eval (cons print-user-fields user-fields) 
>> (procedure-environment (apply hook-helper args))))
>
> Using local-eval and procedure-environment like this won't work in Guile
> 1.9/2.0, I believe.
>
> But you could get a similar effect - which I think will still work in
> 1.9/2.0 - by creating a module, defining values in it, and then
> evaluating in that module.  (In Guile, module == top level
> environment.)

Yes, I think this is the best option, too. FWIW anyway :)

Andy
-- 
http://wingolog.org/



reply via email to

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