Sisyphus
2012-03-18 11:19:56 UTC
Hi,
The xs code that Inline::C auto-generates normally begins with:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
Does Inline::C currently accommodate the inclusion of any pre-processing
code *before* that block ?
Afaict, it doesn't ... but perhaps it's just that I've missed it.
I know of at least one example (on Windows) where such capability would be
convenient, and can think of (hypothetical) situations where it would be
necessary.
Let's say you need Inline::C to auto-generate an XS file that begins with:
#ifdef SOMETHING
#define SOME_VALUE 0
#else
#define SOME_VALUE 1
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
How would you achieve that with Inline::C ? (I couldn't find a way.)
To add to the mystery, C.pm assigns the following:
$o->{ILSM}{AUTO_INCLUDE} ||= <<END;
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
END
Now the '||=' suggests it's possible that AUTO_INCLUDE has already been
defined - yet, again, I failed to see a way to have it already defined by
the time that code was executed.
Cheers,
Rob
The xs code that Inline::C auto-generates normally begins with:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
Does Inline::C currently accommodate the inclusion of any pre-processing
code *before* that block ?
Afaict, it doesn't ... but perhaps it's just that I've missed it.
I know of at least one example (on Windows) where such capability would be
convenient, and can think of (hypothetical) situations where it would be
necessary.
Let's say you need Inline::C to auto-generate an XS file that begins with:
#ifdef SOMETHING
#define SOME_VALUE 0
#else
#define SOME_VALUE 1
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
How would you achieve that with Inline::C ? (I couldn't find a way.)
To add to the mystery, C.pm assigns the following:
$o->{ILSM}{AUTO_INCLUDE} ||= <<END;
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"
END
Now the '||=' suggests it's possible that AUTO_INCLUDE has already been
defined - yet, again, I failed to see a way to have it already defined by
the time that code was executed.
Cheers,
Rob