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

Re: typemap for AV* leaks

Thread Previous | Thread Next
Steffen Mueller
October 9, 2011 11:58
Re: typemap for AV* leaks
Message ID:

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 

> 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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About