M
Mark P
I have a header file and want to expose only a limited portion of that
file to SWIG (all you need to know is that when SWIG processes a file
the preprocessor macro SWIG is defined). Otherwise I want to expose the
entire file. Here's a schematic 5 line example; let's suppose I only
want to expose lines 2 and 4.
line 1
line 2
line 3
line 4
line 5
One option is:
#ifndef SWIG
line 1
#endif
line 2
#ifndef SWIG
line 3
#endif
line 4
#ifndef SWIG
line 5
#endif
This works, but what I don't like about it is that's it's phrased in the
"negative" and highlights all the things that aren't exposed to SWIG.
What I'd rather do is something like:
#ifdef SWIG
"ignore everything except labelled code"
line 1
// label on
line 2
// label off
line 3
// label on
line 4
// label off
line 5
#endif
Is there any clever trick to make this work?
file to SWIG (all you need to know is that when SWIG processes a file
the preprocessor macro SWIG is defined). Otherwise I want to expose the
entire file. Here's a schematic 5 line example; let's suppose I only
want to expose lines 2 and 4.
line 1
line 2
line 3
line 4
line 5
One option is:
#ifndef SWIG
line 1
#endif
line 2
#ifndef SWIG
line 3
#endif
line 4
#ifndef SWIG
line 5
#endif
This works, but what I don't like about it is that's it's phrased in the
"negative" and highlights all the things that aren't exposed to SWIG.
What I'd rather do is something like:
#ifdef SWIG
"ignore everything except labelled code"
line 1
// label on
line 2
// label off
line 3
// label on
line 4
// label off
line 5
#endif
Is there any clever trick to make this work?