manpagez: man pages & more
info guile-tut
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 What is libguile

Libguile is the library which allows C programs to start a Scheme interpreter and execute Scheme code. There are also facilities in libguile to make C data structures available to Scheme, and vice versa.

The interface provided by the libguile C library is somewhat specific to the implementation of the Scheme interpreter. This low-level libguile interface is usually referred to as the scm_ interface, since its public calls (API) all have the scm_ prefix.

There is also a higher-level libguile interface, which is usually referred to as the gh_ interface (libGuile High). Its public calls all have the gh_ prefix. The gh_ library interface is designed to hide the implementation details, thus making it easier to assimilate and portable to other underlying Scheme implementations.

People extending Guile by adding bindings to C libraries (like OpenGL or Rx) are encouraged to use the gh_ interface, so their work will be portable to other Scheme systems. The gh_ interface should be more stable, because it is simpler.

The scm_ interface is necessary if you want to poke into the innards of Scheme data structures, or do anything else that is not offered by the gh_ interface. It is not covered in this tutorial, but is covered extensively in (guile)Data representation section `Data Representation in Guile' in Guile Reference Manual.

This chapter gives a gentle introduction to the gh_ interface, presenting some hello world-style programs which I wrote while teaching myself to use libguile.

The Guile Programmer's Manual gives more examples of programs written using libguile, illustrating diverse applications. You can also consult my Gnudl documentation at http://nis-www.lanl.gov/~rosalia/mydocs/ to see a large scale project that uses C and Scheme code together.


© manpagez.com 2000-2024
Individual documents may contain additional copyright information.