[Top][All Lists]

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

Re: Using guile to extend gaim

From: Mike Gran
Subject: Re: Using guile to extend gaim
Date: Tue, 17 Jun 2003 07:37:31 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313

<address@hidden> writes:

3) Is there an example on calling a generic function with C?

I don't know if this is right.  (The ref manual is a little unclear on what is 
the right way to do things.)  But I've done it this way.

#include <stdio.h>
#include <stdlib.h>
#include <libguile.h>

int main (int argc, char *argv[])
        SCM func_symbol;
        SCM func;
        // Load the scheme function definitions
        scm_c_primitive_load ("script.scm");  
        // Call func "do-hello" with 0 args
        func_symbol = scm_c_lookup("do-hello");
        func = scm_variable_ref(func_symbol);
        scm_call_0 (func);

} -------------------------------
(define do-hello
 (lambda ()
(display "Hello world.") (newline)))

reply via email to

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