I am writing a C/C++ extension module for other languages and I am using SWIG to generate the bindings.
I have two questions
Can I include more than 1 header file in the declaration part of the interface file e.g.:
/* Declarations exposed to wrapper: */
> %{ > #define SWIG_FILE_WITH_INIT > #include "a.h" > #include "b.h" > #include "c.h" %}
In all of the examples I have seen so far, after the header include declaration (as shown above), the functions declared in the header are then declared again in the interface file. Is this really necessary, as it means there are two copies of the function declarations that need to be maintained.
Note: I can appreciate that some functions/methods declaration may need to be 'decorated' with the 'newobject' declaration so these obviously need to be in the interface file, to avoid memory leaks - however, I would have though that it would be sufficient to include the headers and then ONLY the declarations of the functions/methods that need to be declared with 'newobject' - is this recommended way of doing things?