develooper Front page | perl.perl5.porters | Postings from October 2011

Re: typemap for AV* leaks

Thread Previous | Thread Next
From:
Steffen Mueller
Date:
October 9, 2011 11:58
Subject:
Re: typemap for AV* leaks
Message ID:
4E91EEC4.6060203@cpan.org
Hey,

Sorry for the delay.

On 09/09/2011 10:57 AM, Tony Cook wrote:
> On Fri, Sep 09, 2011 at 08:12:50AM +0200, Steffen Mueller wrote:
>> Any ideas? Takers? I'd just love to have a backward compatible way
>> to fix typemaps.
>
> Simple and dumb:
>
> Provide a T_AVREF_FIXED, XS modules that want the fixed behaviour can
> add a C<AV * T_AVREF_FIXED>  entry to their local typemap.

Indeed. And this is pretty much what I just did (including tests in 
XS::Typemap).

> More complex:
>
> Add a TYPEMAP_VERSION XS directive that defines a desired version.
> xsubpp then defines a macro in the generated code with that version,
> and we change the OUTPUT for T_AVREF to:
>
>    #if defined(TYPEMAP_VERSION)&&  TYPEMAP_VERSION>  100 /* whatever number */
>      $arg = sv_2mortal(newRV((SV*)$var));
>    #else
>      /* old, broken behaviour, use TYPEMAP_VERSION: 101 to avoid */
>      $arg = newRV((SV*)$var);
>    #endif
>
> Or the .xs could just define the TYPEMAP_VERSION macro itself.
>
> Such modules would need to build_requires a recent enough ExtUtils::ParseXS.

... and thus require manual action again. Not to say that this is a bad 
plan overall, but I haven't had the time to think it through -- despite 
the long time since your email. EU::ParseXS and the core typemaps are 
only loosely coupled. Eventually, we should dual-life the core typemaps 
along with ParseXS.

Cheers,
Steffen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About