Can I #define void for swig library?
I am trying to use SWIG to create a python frontend for a library in which I have no control over the source. For some reason, the library has the following line:
#define VOID void
This causes all the problems with SWIG; it seems that VOID is the actual object returning these functions.
Is there any way to tell SWIG what it VOID
means VOID
?
source to share
When I created my SWIG interface file, I copied the function prototypes verbatim VOID
and that's it. if i changed all prototypes in my interface file with help VOID
to use the VOID
problem disappeared.
SWIG seems to respect the preprocessor, it just doesn't have its own interface file, which is understandable.
Posting it here for future searchers ...
source to share
Hold on a second ... if you don't have the source for the library, I assume you mean what's #define VOID void
going on in the header (.H) file you include in order to use that library. If the library is already compiled, then it #define VOID void
does not affect it and is only relevant for these headers. Directives #define
only affect your preprocessor which compiles your code (the library is already built). So, if only those headers are using the VOID thing, make sure those headers are #define VOID void
at the top and #undef VOID
bottom to remove the VOID macro.
source to share