unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Invoking guile procs from C in an efficient way
@ 2004-10-25 11:12 Victor Morilla
  2004-10-25 14:18 ` Andreas Rottmann
  0 siblings, 1 reply; 5+ messages in thread
From: Victor Morilla @ 2004-10-25 11:12 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 434 bytes --]

Hello,
 
I would like to know the best way to resolve a proc symbol from its name and call it from c. Right now, I'm using:
 
SCM proc = scm_c_eval_string("my_proc");
scm_apply(proc, argslist, SCM_EOL);
 
Is there an alternative to scm_c_eval_string ? I have used scm_c_lookup
 
SCM proc = scm_c_lookup("my_proc");
scm_apply(proc, argslist, SCM_EOL);
 
, but I get an error
 
Thanks in advance


		
---------------------------------


[-- Attachment #1.2: Type: text/html, Size: 889 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Invoking guile procs from C in an efficient way
@ 2004-10-26 20:58 Victor Morilla
  2004-10-27  3:12 ` Rob Browning
  0 siblings, 1 reply; 5+ messages in thread
From: Victor Morilla @ 2004-10-26 20:58 UTC (permalink / raw)


Rob Browning wrote:
>
>In some cases you can also cache the binding if you
want to avoid
>repeated lookups (using 1.6 interfaces):
>
> foo()
>  {
>    static SCM my_proc = SCM_BOOL_F;
>    if(SCM_FALSEP(my_proc))
>    {
>      my_proc = scm_c_lookup("my-proc");  /* or
scm_c_module_lookup */
>      /* check for failure here */
>      scm_permanent_object(my_proc); /* presumes you
always need my_proc */
>    }

>    scm_apply(scm_variable_ref(my_proc), argslist,
SCM_EOL);
>  }

Thank you, Rob.

Why scm_permanent_object is used ? Would it be
equivalent something like:

foo()
{
  static SCM my_proc =
scm_variable_ref(scm_c_lookup("my-proc"));
  scm_apply(my_proc, argslist, SCM_EOL);
}




	
		
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-10-27  3:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-25 11:12 Invoking guile procs from C in an efficient way Victor Morilla
2004-10-25 14:18 ` Andreas Rottmann
2004-10-25 16:51   ` Rob Browning
  -- strict thread matches above, loose matches on Subject: below --
2004-10-26 20:58 Victor Morilla
2004-10-27  3:12 ` Rob Browning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).