summaryrefslogtreecommitdiff
path: root/XSUB.h
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters.nicoh.com>1996-01-01 22:57:57 +0000
committerAndy Dougherty <doughera.lafayette.edu>1996-01-01 22:57:57 +0000
commit720fb644424900350db135e470934a00919daa13 (patch)
tree000caa20e122e508747478fb0eecef7b99cafc88 /XSUB.h
parenteacfb5f1b1b6501c3ffe81cb467299aad7f0eae6 (diff)
downloadperl-720fb644424900350db135e470934a00919daa13.tar.gz
Updated to match xsubpp-1.929.
Diffstat (limited to 'XSUB.h')
-rw-r--r--XSUB.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/XSUB.h b/XSUB.h
index 78a922defd..f8d31079fc 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -35,3 +35,22 @@
#define XSRETURN_EMPTY do { XSRETURN(0); } while (0)
#define newXSproto(a,b,c,d) sv_setpv((SV*)newXS(a,b,c), d)
+
+#ifdef XS_VERSION
+# define XS_VERSION_BOOTCHECK \
+ do { \
+ char vn[255], *module = SvPV(ST(0),na); \
+ if (items >= 2) /* version supplied as bootstrap arg */ \
+ Sv=ST(1); \
+ else { /* read version from module::VERSION */ \
+ sprintf(vn,"%s::VERSION", module); \
+ Sv = perl_get_sv(vn, FALSE); /* XXX GV_ADDWARN */ \
+ } \
+ if (Sv && (!SvOK(Sv) || strNE(XS_VERSION, SvPV(Sv,na))) ) \
+ croak("%s object version %s does not match %s.pm $VERSION %s", \
+ module,XS_VERSION, module,(Sv && SvOK(Sv))?SvPV(Sv,na):"(undef)");\
+ } while (0)
+#else
+# define XS_VERSION_BOOTCHECK
+#endif
+