[Xapian-discuss] Is Xapian accessable from C?

Olly Betts olly at survex.com
Mon Oct 18 02:00:46 BST 2004


On Sat, Oct 16, 2004 at 06:44:07PM -0700, Eric Parusel wrote:
> 	Is Xapian accessable from C?
> I would think so, but...
> I couldn't find anything in the documentation and unfortunately my 
> knowledge is lacking in C -> C++ libs usage?

There aren't C bindings as there are for Python, Perl, Java, etc.               
To produce a full wrapping would mean replicating a C++-like object
system in C, which is a bit pointless really since C++ already
adds a C++-like object system to C!

Since C is almost a subset of C++ you can just write in the common
subset and compile your C code as C++.  Alternatively restrict use of
Xapian to one file of glue code with external functions marked as
`extern "C"'.  So you might have a function for initialising (which
opens a database), one for adding a term to the current document, one
for starting a new document, and a "finished" function.  You can use
these functions from your C code.

Cheers,
    Olly



More information about the Xapian-discuss mailing list