Linux Today: Linux News On Internet Time.

Scripting with Guile

Jan 25, 2009, 02:01 (0 Talkback[s])
(Other stories by M. Tim Jones)

[ Thanks to An Anonymous Reader for this link. ]

"Listing 1 presents the C application that invokes the Scheme script. The first thing to notice is the inclusion of the libguile.h header file, which makes available the necessary Guile symbols. Next, notice a new type defined: SCM. This type is an abstract C type that represents all Scheme objects contained within Guile. Here, I'm representing the Scheme function that I call later.

"The first thing that needs to be done for any thread using Guile is to make a call to scm_init_guile. This function initializes the global state of Guile and must be called prior to any other Scheme function. Next, prior to calling a Scheme function, the file in which this function resides must be loaded. You do this by using the scm_c_primitive_load function. Note the naming here: the _c_ in the function indicates that it is passed a C variable (rather than a Scheme variable)."

Complete Story

Related Stories: