summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2006-07-17 12:09:24 +0300
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-07-18 21:43:52 +0000
commitbc028b6b7f0f25fba45e10fa46e3fe91dbe9a76d (patch)
tree7c8832aa8af9ba27e527ad1c2f640827b68bb4e0 /pod
parentf782ee33d0f49cb1ee007e3e83d1f175efc6fdc1 (diff)
downloadperl-bc028b6b7f0f25fba45e10fa46e3fe91dbe9a76d.tar.gz
make magic vtables const if PERL_GLOBAL_STRUCT_PRIVATE
Message-ID: <44BB2994.5090609@iki.fi> p4raw-id: //depot/perl@28599
Diffstat (limited to 'pod')
-rw-r--r--pod/perlguts.pod6
-rw-r--r--pod/perlhack.pod13
2 files changed, 15 insertions, 4 deletions
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index a39c8f9cbc..bbf8742d97 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -1914,6 +1914,12 @@ 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.
+To see whether you have non-const data you can use a BSD-compatible C<nm>:
+
+ nm libperl.a | grep -v ' [TURtr] '
+
+If this displays any C<D> or C<d> symbols, you have non-const data.
+
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
diff --git a/pod/perlhack.pod b/pod/perlhack.pod
index f2109bb6bd..efa3344394 100644
--- a/pod/perlhack.pod
+++ b/pod/perlhack.pod
@@ -2404,9 +2404,9 @@ therefore more ways for things to go wrong. You should try it.
Introducing (non-read-only) globals
Do not introduce any modifiable globals, truly global or file static.
-They are bad form and break multithreading. The right way is to
-introduce them as new interpreter variables, see F<intrpvar.h> (at the
-very end for binary compatibility).
+They are bad form and complicate multithreading and other forms of
+concurrency. The right way is to introduce them as new interpreter
+variables, see F<intrpvar.h> (at the very end for binary compatibility).
Introducing read-only (const) globals is okay, as long as you verify
with e.g. C<nm libperl.a|egrep -v ' [TURtr] '> (if your C<nm> has
@@ -2417,12 +2417,17 @@ If you want to have static strings, make them constant:
static const char etc[] = "...";
-If you want to have arrays of static strings, note carefully
+If you want to have arrays of constant strings, note carefully
the right combination of C<const>s:
static const char * const yippee[] =
{"hi", "ho", "silver"};
+There is a way to completely hide any modifiable globals (they are all
+moved to heap), the compilation setting C<-DPERL_GLOBAL_STRUCT_PRIVATE>.
+It is not normally used, but can be used for testing, read more
+about it in L<perlhack>.
+
=item *
Not exporting your new function