guile-user
[Top][All Lists]
Advanced

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

Re: C->Scheme interface


From: Neil Jerram
Subject: Re: C->Scheme interface
Date: 30 Oct 2002 20:17:23 +0000
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "Derek" == Derek Callaway <address@hidden> writes:

    Derek> Suppose I have a Scheme procedure and I'd liked
    Derek> to pass it a number of arguments from within C and then
    Derek> convert the result of that procedure to a properly typed
    Derek> data object which I may subsequently use within C as
    Derek> well. So, how do I go about calling Scheme procedures from
    Derek> C?

Something like this:

scm_call_1 (SCM_VARIABLE_REF (scm_c_lookup ("setup-hb-register")),
            file);

If the Scheme procedure takes 2 args, then use scm_call_2, and so on.

Note that the args here should all be of type SCM, i.e. Scheme
objects.  To convert from typical C types to SCM, check out functions
like scm_makfrom0str and macros like SCM_MAKINUM.  I'm afraid the docs
are not top quality here yet: the manual may help, but you may be able
to deduce more by looking through the Guile code and headers.

        Neil





reply via email to

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