develooper Front page | perl.perl5.porters | Postings from August 2013

Re: [perl #119515] [PATCH] [DOCFIX] - DynaLoader referencesdeprecated newXSUB

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
August 30, 2013 11:43
Subject:
Re: [perl #119515] [PATCH] [DOCFIX] - DynaLoader referencesdeprecated newXSUB
Message ID:
20130830114302.GQ66035@plum.flirble.org
On Thu, Aug 29, 2013 at 07:15:12AM -0700, Matthew Horsfall wrote:

> The DynaLoader documentation for dl_install_xsub says:
> 
>   This is simply a direct call to newXSUB().
> 
> It looks like newXSUB() was removed a long time ago. I've updated the doc
> with:
> 
>   This is simply a direct call to newXS()/newXS_flags().
> 
> Attached is the patch.

Good catch.

> Subject: [PATCH] Replace reference to newXSUB with newXS.
> 
> newXSUB hasn't been around for a long time
> ---
>  ext/DynaLoader/DynaLoader_pm.PL |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL
> index c67b4ab..03d45d1 100644
> --- a/ext/DynaLoader/DynaLoader_pm.PL
> +++ b/ext/DynaLoader/DynaLoader_pm.PL
> @@ -870,7 +870,7 @@ Syntax:
>  
>  Create a new Perl external subroutine named $perl_name using $symref as
>  a pointer to the function which implements the routine.  This is simply
> -a direct call to newXSUB().  Returns a reference to the installed
> +a direct call to newXS()/newXS_flags().  Returns a reference to the installed
>  function.
>  
>  The $filename parameter is used by Perl to identify the source file for

win32 seems to be the only code using newXS(). newXS() And newXS_flags()
are both (now) wrappers to newXS_len_flags(), and possibly some of the
callers of newXS_flags() might change to the latter. So is it better just
to word it as "newXS_len_flags() or one of its wrappers" ?


This history of all this seems to be rather stranger than you might first
think. newXSUB was eliminated ages ago:

commit 5fec647a952947a91de8c7e8de5b2f8a1661fe02
Author: Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Date:   Thu Nov 6 14:37:37 1997 +0000

    Remove #ifdef DEPRECATED stuff: newXSUB, pp_entersubr, FREE_TMPS().
    
    p4raw-id: //depot/perl@206


but it seems that nothing in DynaLoader ever used it. In the 5.000 docs say
that DynaLoader uses newXSUB(), but actually it uses newXS().

Most of DynaLoader's platform specific code switched over to newXS_flags()
with this commit:

commit 77004dee2553ce034a8a58b2b2849e3656df46c3
Author: Nicholas Clark <nick@ccl4.org>
Date:   Tue May 2 15:55:25 2006 +0000

    Fix bug in DynaLoader, which has been passing a filename in dynamic
    storage to newXS() seemingly forever. This involves creating
    newXS_flags(), with the first flag being "arrange to copy the
    filename and free it at the right time".
    
    p4raw-id: //depot/perl@28063


I'm wary of documenting exactly the current state, as I see that
newXS_len_flags() would be preferable to what we have, as it would avoid a
needless strlen() call.

Nicholas Clark

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