summaryrefslogtreecommitdiff
path: root/perlvars.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-11-07 23:58:06 +0000
committerNicholas Clark <nick@ccl4.org>2007-11-07 23:58:06 +0000
commitffee3ff61d01bece17fbf5f9da633f1917fa5c0a (patch)
treee663a44033087b325e33038fc170994972d55bc8 /perlvars.h
parent663f364bd429de50c8f5478879b1285d1270c1b3 (diff)
downloadperl-ffee3ff61d01bece17fbf5f9da633f1917fa5c0a.tar.gz
"Bake" the values of PERL_REVISION, PERL_VERSION and PERL_SUBVERSION
into global variables (and hence a shared perl library). Additionally under MULTIPLICITY record the size of the interpreter structure (total, and for this version) and under PERL_GLOBAL_STRUCT the size of the global variables structure. Coupled with PL_bincompat_options this will allow 5.10.1 (and later), when compiled with a shared perl library, to perform sanity checks in main() to verify that the shared library is indeed binary compatible. p4raw-id: //depot/perl@32238
Diffstat (limited to 'perlvars.h')
-rw-r--r--perlvars.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/perlvars.h b/perlvars.h
index 94a3f954ee..de3c63b005 100644
--- a/perlvars.h
+++ b/perlvars.h
@@ -160,3 +160,29 @@ PERLVARI(Gveto_cleanup, int, FALSE) /* exit without cleanup */
PERLVARI(Grunops_std, runops_proc_t, MEMBER_TO_FPTR(Perl_runops_standard))
PERLVARI(Grunops_dbg, runops_proc_t, MEMBER_TO_FPTR(Perl_runops_debug))
+
+/* These are baked at compile time into any shared perl library.
+ In future 5.10.x releases this will allow us in main() to sanity test the
+ library we're linking against. */
+
+PERLVARI(Grevision, U8, PERL_REVISION)
+PERLVARI(Gversion, U8, PERL_VERSION)
+PERLVARI(Gsubversion, U8, PERL_SUBVERSION)
+
+#if defined(MULTIPLICITY)
+# define PERL_INTERPRETER_SIZE_UPTO_MEMBER(member) \
+ STRUCT_OFFSET(struct interpreter, member) + \
+ sizeof(((struct interpreter*)0)->member)
+
+/* These might be useful. */
+PERLVARI(Ginterpreter_size, U16, sizeof(struct interpreter))
+#if defined(PERL_GLOBAL_STRUCT)
+PERLVARI(Gglobal_struct_size, U16, sizeof(struct perl_vars))
+#endif
+
+/* This will be useful for subsequent releases, because this has to be the
+ same in your libperl as in main(), else you have a mismatch and must abort.
+*/
+PERLVARI(Ginterpreter_size_5_10_0, U16,
+ PERL_INTERPRETER_SIZE_UPTO_MEMBER(PERL_LAST_5_10_0_INTERP_MEMBER))
+#endif