summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Vatiainen <hvn@radiatorsoftware.com>2023-12-10 13:25:25 +0200
committerHeikki Vatiainen <hvn@radiatorsoftware.com>2023-12-10 15:37:53 +0200
commit7def5e5a053ce843d4e6238b71bc6addd0b9f1a8 (patch)
tree228b6ac8f264cb6ea81c3c6e16ee3f1ca9ae9825
parenteb097e9abf3c82f78472002e90e4fe8f3d8d63a9 (diff)
GH-438 Remove 'extern "C"' wrapper around Perl XS includes.
'extern "C" {}' block has wrapped Perl XS standard includes since the beginning. The earliest version found from the net is Net_SSLeay.pm version 0.4 in which the following was already present: #ifdef __cplusplus extern "C" { #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifdef __cplusplus } #endif This has been carried over since then, until the recent SSLeay.xs updates to allow compilation with a C++ compiler caused a compilation failure. Recent GCC and Clang C++ compilers do not care about the 'extern "C"' wrapper but Visual Studio Community 2022 flagged the following error (see GH-438): C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\wspiapi.h(53): error C2894: templates cannot be declared to have 'C ' linkage When 'extern "C" {}' is removed completely, the compilation succeeds. This makes sense since apparently the purpose of 'extern "C" {}' is to wrap one's own functions instead of headers included from elsewhere. Those headers should have their own 'extern "C" {}' definitions, if any are needed.
-rw-r--r--Changes5
-rw-r--r--SSLeay.xs6
2 files changed, 5 insertions, 6 deletions
diff --git a/Changes b/Changes
index 5245ed2..0aa47ea 100644
--- a/Changes
+++ b/Changes
@@ -89,6 +89,11 @@ Revision history for Perl extension Net::SSLeay.
- Add OpenSSL 3.2 and LibreSSL 3.8 minor releases to GitHub CI
testing. Update existing OpenSSL releases to 1.1.1w, 3.0.12
and 3.1.4.
+ - Support compiling SSLeay.xs with a C++ compiler. Thanks to
+ James E Keenan and GitHub user twata1 for suggesting this,
+ testing and providing detailed test reports. Tested with GCC
+ 13 g++, Clang 17 clang++ and Visual Studio Community 2022
+ C++ compilers. Discussion in GH-425 and GH-438.
1.93_02 2023-02-22
- Update ppport.h to version 3.68. This eliminates thousands of
diff --git a/SSLeay.xs b/SSLeay.xs
index df96ecb..f76960b 100644
--- a/SSLeay.xs
+++ b/SSLeay.xs
@@ -143,18 +143,12 @@
#pragma clang diagnostic warning "-Wunknown-warning-option"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <stdarg.h>
#define NEED_my_snprintf
#include "ppport.h"
-#ifdef __cplusplus
-}
-#endif
/* Sigh: openssl 1.0 has
typedef void *BLOCK;