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

Compatibility between Perl versions

From:
Moore, Paul
Date:
November 9, 2000 05:42
Subject:
Compatibility between Perl versions
Message ID:
714DFA46B9BBD0119CD000805FC1F53B012A8399@UKRUX002.rundc.uk.origin-it.com
I have an existing bit of XS code which worked under Perl 5.005, which I
want to upgrade to Perl 5.6, while retaining 5.005 compatibility. The big
issue is all the THX-style calls, as well as PERL_SET_CONTEXT and co.
There's nothing in the docs, not even describing how to use the things, let
alone describing how to use them in a 5.005-compatible way...

I know that using the THXo stuff directly is probably not the correct way of
doing things, but it's code I inherited, and I can't easily change. FWIW,
it's the Perl interface for the Vim editor. It's full of things like (NB:
the DYNAMIC_PERL is a misnomer - the whole point is that I'm trying to
disentangle the 5.6=isms from the dynamic loading stuff...)

#ifdef DYNAMIC_PERL /* TODO: This is for 5.6 */
static void xs_init __ARGS((pTHXo));
#else
static void xs_init __ARGS((void));
#endif

and a bunch of function pointer definitions like "static I32
(*Perl_call_pv)(pTHX_ const char*, I32);" which are to allow for on-demand
dynamic loading of the Perl DLL.

It looks to me like I just have to #define pTHXo as void, pTHX as void, and
pTHX_ as empty.

There's also a
#ifdef DYNAMIC_PERL	/* is this right? TODO: This is a 5.6-ism... */
	PERL_SET_CONTEXT(0);
#endif

in a perl_end() function, just after perl_run/perl_destruct/perl_free, and
before we set perl_interp to NULL. This seems a little late to be useful,
but I don't know what PERL_SET_CONTEXT is for, so I could do with some
enlightenment...

Thanks for any help,
Paul Moore.



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