Copyright (C) 2000-2012 |
GNU Info (g-wrap.info)A More Detailed Example.A More Detailed Example. ======================== In this chapter we'll walk through the process of wrapping an incresingly complex C API. In the process, we'll try to hit all the important g-wrap features. You'll see how to define a wrapper module, add new types to it (when the default set of types isn't sufficient), wrap the C-side functions, and then generate the Guile wrapper code from the wrapper module definition. To start, let's presume you want to wrap a C interface that initially looks like this: char* join_strings(char *a, char *b); double seconds_since_dow(unsigned int day_of_the_week); and you want to call your wrapper module "miscutils". To define your module, you need to create a wrapper specification, which is just a file (or files) of scheme code that calls g-wrap functions to create the wrapper module. Conventionally, if you're creating a wrapper module named "foo", the wrapper-module specification file would be named foo-spec.scm. automatically generated by info2www version 1.2.2.9 |