Bill Moseley <[EMAIL PROTECTED]> writes:
>I have an xsub that doesn't work under 5.00503 because is uses call_pv
>instead of perl_call_pv.  I must of missed something somewhere -- what's
>the method to make the code work in different versions of perl?
>
>I added:
>
>#ifndef call_pv
>#   define call_pv(i,j) perl_call_pv(i,j)
>#endif

If you ever have threads or multiplicity that needs to be 

#ifndef call_pv
#   define call_pv(i,j) perl_call_pv(aTHX_ i,j)
#endif

and you need to have a conext arg in scope - i.e. a dTHX to fetch 
it or a pTHX to pass it in to the caller (XSubs have one to hand).

It was to hide all that noise that call_pv() was invented.

I consider it a mixed blessing - its magical calling of "get context" 
can become resource hog. Doing it the old way with perl_call_pv() and 
"explicit" aTHX_  not only works on older perl's but can give better 
code on modern ones.

(The PERL_NO_GET_CONTEXT mentioned in another thread turns off the 
 magical fetching and requires you to have dTHX / pTHX but still 
 supplies the aTHX as required.)

dTHX - declare THread conteXt.
pTHX - prototype THread conteXt.
aTHX - actual/argument THread conteXt.

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/

Reply via email to