Yeah,
What I'm doing is calling different funcs depending on OS (*nix and/or
win32) dealing with devices (cdroms). So the linux version calls with one
less param (no dev/drive) vs. the windows version needs to know what drive
(incase multiple cd drives exist). I'm currently doing this before calling
the xs code but would like to find a way to move this outta the perl code
into either XS or the c code (but with function defs..) I don't see any
clean way around this. Any ideas?
David S.
-----Original Message-----
From: Vivek Dasmohapatra [mailto:[EMAIL PROTECTED]]
Sent: Sunday, September 16, 2001 5:08 AM
To: David Shultz
Cc: [EMAIL PROTECTED]
Subject: Re: ifdefs in xs?
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