On Sat, 15 Sep 2001, David Shultz wrote:
> Does anyone know if/how you can do ifdefs in xs?
In the C section of the XS file [ie before the MODULE tag] you are writing
C, with some magic perl headers pulled in by the build system - you can put
ifdefs there. Also, I like to keep my XS declarations relatively small,
and put the bulk of the function in a separate .c file, eg my XS declaration
might say just:
int
_cancel_order (ARG, flags)
SV * ARG
int flags
And then I have separate cancel.c and cancel.h files which contain things
like:
int _cancel_order (SV *X, int flags)
{
int retval;
CLIENT *client;
.
.
.
and [in the .h file]:
#ifndef FOO_CANCEL_H
#define FOO_CANCEL_H
#include "foo_internals.h"
extern int _cancel_order (SV *X, int flags);
#endif /* FOO_CANCEL_H */
--
Vivek