Change 31697 by [EMAIL PROTECTED] on 2007/08/10 05:42:26

        SWIG uses XS() like this (in the perlrun.swg template):
        
        typedef XS(SwigPerlWrapper);
        typedef SwigPerlWrapper *SwigPerlWrapperPtr;
        
        This breaks if XS() includes the 'extern "C"' decoration under C++.
        The appended patch provides an XSPROTO() macro that could be used
        by SWIG instead.
        
        (Patch from Jan Dubois to fix breakage caused by #28734.)

Affected files ...

... //depot/perl/XSUB.h#124 edit

Differences ...

==== //depot/perl/XSUB.h#124 (text) ====
Index: perl/XSUB.h
--- perl/XSUB.h#123~31653~      2007-07-25 05:15:18.000000000 -0700
+++ perl/XSUB.h 2007-08-09 22:42:26.000000000 -0700
@@ -96,21 +96,33 @@
 
 #define ST(off) PL_stack_base[ax + (off)]
 
+/* XSPROTO() is also used by SWIG like this:
+ *
+ *     typedef XSPROTO(SwigPerlWrapper);
+ *     typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+ *
+ * This code needs to be compilable under both C and C++.
+ *
+ * Don't forget to change the __attribute__unused__ version of XS()
+ * below too if you change XSPROTO() here.
+ */
+#define XSPROTO(name) void name(pTHX_ CV* cv)
+
 #undef XS
 #if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
-#  define XS(name) __declspec(dllexport) void name(pTHX_ CV* cv)
+#  define XS(name) __declspec(dllexport) XSPROTO(name)
 #endif
 #if defined(__SYMBIAN32__)
-#  define XS(name) EXPORT_C void name(pTHX_ CV* cv)
+#  define XS(name) EXPORT_C XSPROTO(name)
 #endif
 #ifndef XS
 #  if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
 #    define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
 #  else
 #    ifdef __cplusplus
-#      define XS(name) extern "C" void name(pTHX_ CV* cv)
+#      define XS(name) extern "C" XSPROTO(name)
 #    else
-#      define XS(name) void name(pTHX_ CV* cv)
+#      define XS(name) XSPROTO(name)
 #    endif
 #  endif
 #endif
End of Patch.

Reply via email to