The C Binding

16th October 2001

C Binding Specification

The C binding is maintained by Adam Dickmeiss <adam@indexdata.dk>

You probably want the current version.

The C binding is essentially identical to the C++ one, except that the object orientation must be ``faked'' using function-name prefixes, explicit object-pointer parameters, and a destructor-like ``free'' function for each class.

The following version of the interface specification are available:

Canonical Sample Program

To give a flavour of the C binding, here is ZOOM's equivalent of the ``Hello World'' program: a tiny Z39.50 client that fetches and displays the MARC record for Farlow & Brett Surman's The Complete Dinosaur from the Library of Congress.

#include <stdio.h>
#include <yaz/zoom.h>

int main(int argc, char **argv)
{
    ZOOM_connection z = ZOOM_connection_new ("z3950.loc.gov:7090/Voyager", 0);
    ZOOM_resultset r;
    const char *rec;

    ZOOM_connection_option_set(z, "preferredRecordSyntax", "USMARC");
    r = ZOOM_connection_search_pqf(z, "@attr 1=7 0253333490");
    rec =  ZOOM_record_get (ZOOM_resultset_record (r, 0), "render", 0);
    if (rec)
        printf ("%s\n", rec);
    return 0;
} 

C Binding Implementations

We currently have the following implementations of the C binding:

Feedback to <mike@indexdata.com> is welcome!