diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2005-04-18 16:18:30 +0300 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-04-21 15:38:30 +0000 |
commit | 27da23d53ccce622bc51822f59df8def79b4df95 (patch) | |
tree | 1202440e0fbf7a2fc1bb54993d11cda7b245f1b4 /pod/perlguts.pod | |
parent | ec0624293b57ae07d6b2c32bae099d4f163e7e07 (diff) | |
download | perl-27da23d53ccce622bc51822f59df8def79b4df95.tar.gz |
Symbian port of Perl
Message-ID: <B356D8F434D20B40A8CEDAEC305A1F2453D653@esebe105.NOE.Nokia.com>
p4raw-id: //depot/perl@24271
Diffstat (limited to 'pod/perlguts.pod')
-rw-r--r-- | pod/perlguts.pod | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pod/perlguts.pod b/pod/perlguts.pod index d95d3e4c03..df90f9e137 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -1871,6 +1871,26 @@ PERL_IMPLICIT_CONTEXT is also normally defined, and enables the support for passing in a "hidden" first argument that represents all three data structures. +Two other "encapsulation" macros are the PERL_GLOBAL_STRUCT and +PERL_GLOBAL_STRUCT_PRIVATE (the latter turns on the former, and the +former turns on MULTIPLICITY.) The PERL_GLOBAL_STRUCT causes all the +internal variables of Perl to be wrapped inside a single global struct, +struct perl_vars, accessible as (globals) &PL_Vars or PL_VarsPtr or +the function Perl_GetVars(). The PERL_GLOBAL_STRUCT_PRIVATE goes +one step further, there is still a single struct (allocated in main() +either from heap or from stack) but there are no global data symbols +pointing to it. In either case the global struct should be initialised +as the very first thing in main() using Perl_init_global_struct() and +correspondingly tear it down after perl_free() using Perl_free_global_struct(), +please see F<miniperlmain.c> for usage details. You may also need +to use C<dVAR> in your coding to "declare the global variables" +when you are using them. dTHX does this for you automatically. + +For backward compatibility reasons defining just PERL_GLOBAL_STRUCT +doesn't actually hide all symbols inside a big global struct: some +PerlIO_xxx vtables are left visible. The PERL_GLOBAL_STRUCT_PRIVATE +then hides everything (see how the PERLIO_FUNCS_DECL is used). + All this obviously requires a way for the Perl internal functions to be either subroutines taking some kind of structure as the first argument, or subroutines taking nothing as the first argument. To @@ -2072,6 +2092,13 @@ Never add a comma after C<pTHX> yourself--always use the form of the macro with the underscore for functions that take explicit arguments, or the form without the argument for functions with no explicit arguments. +If one is compiling Perl with the C<-DPERL_GLOBAL_STRUCT> the C<dVAR> +definition is needed if the Perl global variables (see F<perlvars.h> +or F<globvar.sym>) are accessed in the function and C<dTHX> is not +used (the C<dTHX> includes the C<dVAR> if necessary). One notices +the need for C<dVAR> only with the said compile-time define, because +otherwise the Perl global variables are visible as-is. + =head2 Should I do anything special if I call perl from multiple threads? If you create interpreters in one thread and then proceed to call them in |