[Xapian-devel] Summer of Code help
Olly Betts
olly at survex.com
Sun Feb 23 23:23:58 GMT 2014
Quoting from IRC:
> I am using SWIG for the first time. The interface file that we create
> must have only the declaration statements with proper syntax, right?
The interface file can contain SWIG directives, and also C/C++
declarations (classes, function prototypes, etc) - generally what
you'd put in the C/C++ header file (and in fact you can often get
SWIG to parse your header files for those, which is what we try to do
for Xapian, as it means we don't have to maintain two parallel pieces
of code which describe the C++ API).
You generally wouldn't show SWIG the function definitions (i.e. the
bodies of the functions), except for inline functions.
There are also a few limitations to SWIG's parsing of C and C++ code,
but they are generally fairly obscure things.
> I mean the conditional statements in the code are not to be included.
> isn't it?
Do you mean preprocessor conditionals (#if, etc) or C/C++ conditonals
(if (a) { /*code*/ } else { /*code*/ })?
SWIG understands preprocessor conditionals, though you may need to tell
it what macros to define to get the behaviour you want (as it won't
predefine all the macros your compiler does).
It should just ignore C/C++ conditionals in a function body.
Cheers,
Olly
More information about the Xapian-devel
mailing list