[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: New way to do XS constants
On Fri, Jan 07, 2000 at 11:18:04AM +0000, Tim Bunce wrote:
> On Fri, Jan 07, 2000 at 10:08:12AM +0000, Graham Barr wrote:
> > On Fri, Jan 07, 2000 at 09:58:56AM +0000, Tim Bunce wrote:
> > > FYI: All those advantages also apply to this very simple method:
> > >
[snip]
> > >
> > > Using a single XS sub and multiple XS aliases instead of multiple perl
> > > subs uses very little memory (far less than multiple perl subs).
> > > It also has a very low start-up overhead (just one newXS() call each).
> >
> > But this does not create a constant sub. It also does not allow you use
> > #ifdef for the constants.
>
> Ah yes, I'd forgotten that approach wasn't enough. That's what I get
> for being away from the perl source too long ;-)
>
> > Take a look at the end of IO.xs
>
> newCONSTSUB(stash,"POLLPRI", newSViv(POLLPRI));
>
> I hadn't used newCONSTSUB for DBD::Oracle (where I use the xsubpp ALIAS)
> because I wanted more backwards portability. But I could always #ifdef
> a local copy of it for older perls.
How far back do you need ? I belive IO.xs has defines to work back to 5.003
and maybe 5.002
Graham.
- References to:
-
Tye McQueen <tye@metronet.com>
Tim Bunce <Tim.Bunce@ig.co.uk>
Graham Barr <gbarr@pobox.com>
Tim Bunce <Tim.Bunce@ig.co.uk>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]