www.delorie.com/gnu/docs/guile/guile_48.html   search  
 
Buy GNU books!


Guile Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.1.1 Init Snarfing with guile-snarf

When writing C code for use with Guile, you typically define a set of C functions, and then make some of them visible to the Scheme world by calling the scm_c_define_gsubr function; a C function published in this way is called a subr. If you have many subrs to publish, it can sometimes be annoying to keep the list of calls to scm_c_define_gsubr in sync with the list of function definitions. Frequently, a programmer will define a new subr in C, recompile the application, and then discover that the Scheme interpreter cannot see the subr, because of a missed call to scm_c_define_gsubr.

Guile provides the guile-snarf command to manage this problem. Using this tool, you can keep all the information needed to define the subr alongside the function definition itself; guile-snarf will extract this information from your source code, and automatically generate a file of calls to scm_c_define_gsubr which you can #include into an initialization function.

13.1.1.1 How guile-snarf works  Using guile-snarf, with example.
13.1.1.2 Macros guile-snarf recognizes  How to mark up code for guile-snarf.
13.1.1.3 Writing your own snarfing macros  How to define new things to snarf.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003