From fc67fb8721f46cdc1f14a5ab70c08fe6a28896f8 Mon Sep 17 00:00:00 2001 From: Matt Rippa Date: Tue, 29 Mar 2022 19:12:10 -1000 Subject: [PATCH] Fix cplusplus linkage error with extern C --- src/ChecksumConverter.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ChecksumConverter.cc b/src/ChecksumConverter.cc index 53ffcc6..2684d7d 100644 --- a/src/ChecksumConverter.cc +++ b/src/ChecksumConverter.cc @@ -52,11 +52,15 @@ #if defined(vxWorks) || defined(__rtems__) // These systems have no strncasecmp at the moment // But avoid compiler errors in case strncasecmp exists in future versions -static int mystrncasecmp(const char *s1, const char *s2, size_t n) -{ - int r=0; - while (n && (r = toupper(*s1)-toupper(*s2)) == 0) { n--; s1++; s2++; }; - return r; +extern "C" { + + static int mystrncasecmp(const char *s1, const char *s2, size_t n) + { + int r=0; + while (n && (r = toupper(*s1)-toupper(*s2)) == 0) { n--; s1++; s2++; }; + return r; + } + } #define strncasecmp mystrncasecmp #endif