summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/XSUB.h
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/XSUB.h')
-rw-r--r--gnu/usr.bin/perl/XSUB.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/usr.bin/perl/XSUB.h b/gnu/usr.bin/perl/XSUB.h
index 2a8e90c7f06..547f2d3722b 100644
--- a/gnu/usr.bin/perl/XSUB.h
+++ b/gnu/usr.bin/perl/XSUB.h
@@ -91,10 +91,14 @@ handled automatically by C<xsubpp>.
#if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
# define XS(name) __declspec(dllexport) void name(pTHX_ CV* cv)
#else
-# ifdef HASATTRIBUTE_UNUSED
+# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
# define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
# else
-# define XS(name) void name(pTHX_ CV* cv)
+# ifdef __cplusplus
+# define XS(name) extern "C" void name(pTHX_ CV* cv)
+# else
+# define XS(name) void name(pTHX_ CV* cv)
+# endif
# endif
#endif