This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix compilation errors in globals.c with MinGW/gcc -xc++
authorSteve Hay <steve.m.hay@googlemail.com>
Wed, 24 Dec 2014 13:11:45 +0000 (13:11 +0000)
committerSteve Hay <steve.m.hay@googlemail.com>
Wed, 24 Dec 2014 13:20:07 +0000 (13:20 +0000)
error: external linkage required for symbol 'PL_charclass' because of
'dllexport' attribute

and likewise for many other symbols declared EXTCONST.

INTERN.h

index da3057a..39b48f4 100644 (file)
--- a/INTERN.h
+++ b/INTERN.h
 #  define dEXTCONST globaldef {"$GLOBAL_RO_VARS"} readonly
 #else
 #  if (defined(WIN32) && defined(__MINGW32__)) || defined(__SYMBIAN32__)
-#    define EXT                __declspec(dllexport)
-#    define dEXT
-#    define EXTCONST   __declspec(dllexport) const
-#    define dEXTCONST  const
+#    ifdef __cplusplus
+#      define EXT      __declspec(dllexport)
+#      define dEXT
+#      define EXTCONST __declspec(dllexport) extern const
+#      define dEXTCONST        const
+#    else
+#      define EXT      __declspec(dllexport)
+#      define dEXT
+#      define EXTCONST __declspec(dllexport) const
+#      define dEXTCONST        const
+#    endif
 #  else
 #    ifdef __cplusplus
 #      define EXT