develooper Front page | perl.perl5.porters | Postings from November 2003

Re: need your help to do some (simple?) patching

Thread Previous | Thread Next
Nick Ing-Simmons
November 17, 2003 01:19
Re: need your help to do some (simple?) patching
Message ID:
Jan Dubois <> writes:
>As I said, I thought this was already the case almost all the time.  I
>just rechecked it and was surprised that both the Perl_safesysmalloc() and
>friends as well as the PerlIO_* functions need dTHX.

The new PerlIO API functions have pTHX_ the legacy ones don't.
This could be fixed, but it as the #define forest round PerlIO is 
already complex it will not be as easy as it looks at first.

>I agree that they should have the *_nocontext versions for XS extensions
>and that the PERL_CORE should always pass the context to them.  If nothing
>else, this should give us some speed gains.  I'm very surprised that the
>memory allocation function all use dTHX; I'll try to ask Sarathy tomorrow
>why this is the case.
>On a tangential note, I also noticed that perlio.c defines dSYS, which
>seems to have the same purpose as dTHXs from perl.h (and is used in e.g.
>util.c).  They should probably be unified.

Ah - I handn't noticed that.
For the un-initiated - dSYS is a dTHX if needed for perlhost type re-direction

>XS modules already don't have to call PERL_SET_CONTEXT at all if you write
>them correctly (using PERL_NO_GET_CONTEXT, passing the context explicitly
>to pure C functions).  Maybe this information should be published more
>prominently so that new modules take advantage of that.

It is a pain to upgrade a complex XS to PERL_NO_GET_CONTEXT style,
but it should be encouraged.

Tk has problems in that callbacks need to get an aTHX from somewhere.

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