Revision history for Perl extension ExtUtils::ParseXS.
+3.04_01 - Sun Aug 28 17:50:00 CET 2011
+
+ - The XSUB.h changes to make XS(name) use XS_INTERNAL(name)
+ by default (which were in the 5.15.2 dev release of perl)
+ have been reverted since too many CPAN modules expect to
+ be able to refer to XSUBs declared with XS(name).
+ Instead, ExtUtils::ParseXS will define a copy of the
+ XS_INTERNAL/XS_EXTERNAL macros as necessary going back to
+ perl 5.10.0 (which is the oldest perl I had for testing).
+ By default, ExtUtils::ParseXS will use XS_INTERNAL(name)
+ instead of XS(name).
+
3.04 - Thu Aug 25 08:20:00 CET 2011
- Stable release based on 3.03_03, no functional changes.
our $VERSION;
BEGIN {
- $VERSION = '3.04';
+ $VERSION = '3.04_01';
}
use ExtUtils::ParseXS::Constants $VERSION;
use ExtUtils::ParseXS::CountLines $VERSION;
# print function header
print Q(<<"EOF");
#$externC
-#XS(XS_${Full_func_name}); /* prototype to pass -Wmissing-prototypes */
-#XS(XS_${Full_func_name})
+#XS_EUPXS(XS_${Full_func_name}); /* prototype to pass -Wmissing-prototypes */
+#XS_EUPXS(XS_${Full_func_name})
#[[
##ifdef dVAR
# dVAR; dXSARGS;
if ($self->{Overload}) { # make it findable with fetchmethod
print Q(<<"EOF");
-#XS(XS_$self->{Packid}_nil); /* prototype to pass -Wmissing-prototypes */
-#XS(XS_$self->{Packid}_nil)
+#XS_EUPXS(XS_$self->{Packid}_nil); /* prototype to pass -Wmissing-prototypes */
+#XS_EUPXS(XS_$self->{Packid}_nil)
#{
# dXSARGS;
# XSRETURN_EMPTY;
my $xs_impl = $1 eq 'ENABLE' ? 'XS_EXTERNAL' : 'XS_INTERNAL';
print Q(<<"EOF");
-##if (PERL_REVISION == 5 && (PERL_VERSION > 15 || (PERL_VERSION == 15 && PERL_SUBVERSION > 0)))
-##undef XS
-##define XS(name) $xs_impl(name)
-##endif
+##undef XS_EUPXS
+##define XS_EUPXS(name) $xs_impl(name)
EOF
}
use lib qw( lib );
use ExtUtils::ParseXS::Constants ();
-our $VERSION = '3.04';
+our $VERSION = '3.04_01';
our (@ISA, @EXPORT_OK);
@ISA = qw(Exporter);
# define PERL_UNUSED_VAR(var) if (0) var = var
#endif
-/* Starting from 5.15.2, XS(name) defines a static function (==internal)
- * and the XS_EXTERNAL macro is used for functions that must not be static
+
+/* This stuff is not part of the API! You have been warned. */
+#ifndef PERL_VERSION_DECIMAL
+# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
+#endif
+#ifndef PERL_DECIMAL_VERSION
+# define PERL_DECIMAL_VERSION \\
+ PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
+#endif
+#ifndef PERL_VERSION_GE
+# define PERL_VERSION_GE(r,v,s) \\
+ (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
+#endif
+#ifndef PERL_VERSION_LE
+# define PERL_VERSION_LE(r,v,s) \\
+ (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
+#endif
+
+/* XS_INTERNAL is the explicit static-linkage variant of the default
+ * XS macro.
+ *
+ * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
+ * "STATIC", ie. it exports XSUB symbols. You probably don't want that
+ * for anything but the BOOT XSUB.
+ *
+ * See XSUB.h in core!
+ */
+
+
+/* TODO: This might be compatible further back than 5.10.0. */
+#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
+# undef XS_EXTERNAL
+# undef XS_INTERNAL
+# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
+# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
+# define XS_INTERNAL(name) __declspec(dllexport) STATIC XSPROTO(name)
+# endif
+# if defined(__SYMBIAN32__)
+# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
+# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
+# endif
+# ifndef XS_EXTERNAL
+# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
+# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
+# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
+# else
+# ifdef __cplusplus
+# define XS_EXTERNAL(name) extern "C" XSPROTO(name)
+# define XS_INTERNAL(name) static XSPROTO(name)
+# else
+# define XS_EXTERNAL(name) XSPROTO(name)
+# define XS_INTERNAL(name) STATIC XSPROTO(name)
+# endif
+# endif
+# endif
+#endif
+
+/* perl >= 5.10.0 && perl <= 5.15.1 */
+
+
+/* The XS_EXTERNAL macro is used for functions that must not be static
* like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
* macro defined, the best we can do is assume XS is the same.
+ * Dito for XS_INTERNAL.
*/
#ifndef XS_EXTERNAL
# define XS_EXTERNAL(name) XS(name)
#endif
+#ifndef XS_INTERNAL
+# define XS_INTERNAL(name) XS(name)
+#endif
+
+/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
+ * internal macro that we're free to redefine for varying linkage due
+ * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
+ * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
+ */
+
+/* default to internal */
+#undef XS_EUPXS
+#define XS_EUPXS(name) XS_INTERNAL(name)
+
EOF
print <<"EOF";