fixed Windows build errors
authorVictor Kirhenshtein <victor@netxms.org>
Tue, 1 Nov 2016 16:47:08 +0000 (18:47 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Tue, 1 Nov 2016 17:45:06 +0000 (19:45 +0200)
include/nms_common.h
include/nms_util.h
src/libnetxms/main.cpp
src/server/core/nxcore.vcproj

index 9d7fb10..8f981ab 100644 (file)
@@ -167,6 +167,13 @@ typedef int bool;
 
 /********** WINDOWS ********************/
 
+#ifdef _MSC_FULL_VER
+#define __BUILD_VERSION_STRING(s,v) s v
+#define __STR_NX(x) #x
+#define __STR(x) __STR_NX(x)
+#define CPP_COMPILER_VERSION __STR(__BUILD_VERSION_STRING(Microsoft C/C++ Optimizing Compiler Version,_MSC_FULL_VER))
+#endif
+
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT           0x0501
 #endif
index 1a51b9a..81c4d5a 100644 (file)
@@ -111,9 +111,32 @@ inline double bswap_double(double val)
    return result;
 }
 
+#else
+
+#if !(HAVE_DECL_BSWAP_16)
+UINT16 LIBNETXMS_EXPORTABLE __bswap_16(UINT16 val);
+#define bswap_16 __bswap_16
+#endif
+
+#if !(HAVE_DECL_BSWAP_32)
+UINT32 LIBNETXMS_EXPORTABLE __bswap_32(UINT32 val);
+#define bswap_32 __bswap_32
+#endif
+
+#if !(HAVE_DECL_BSWAP_64)
+UINT64 LIBNETXMS_EXPORTABLE __bswap_64(UINT64 val);
+#define bswap_64 __bswap_64
+#endif
+
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 void LIBNETXMS_EXPORTABLE bswap_array_16(UINT16 *v, int len);
 void LIBNETXMS_EXPORTABLE bswap_array_32(UINT32 *v, int len);
-
+#ifdef __cplusplus
+}
 #endif
 
 
index 1495350..3c439cf 100644 (file)
 #include "libnetxms.h"
 
 /**
+ * Wrappers for byte swap functions for C code linking
+ */
+#if !(HAVE_DECL_BSWAP_16)
+extern "C" UINT16 LIBNETXMS_EXPORTABLE __bswap_16(UINT16 val)
+{
+   return bswap_16(val);
+}
+#endif
+
+#if !(HAVE_DECL_BSWAP_32)
+extern "C" UINT32 LIBNETXMS_EXPORTABLE __bswap_32(UINT32 val)
+{
+   return bswap_32(val);
+}
+#endif
+
+#if !(HAVE_DECL_BSWAP_64)
+extern "C" UINT64 LIBNETXMS_EXPORTABLE __bswap_64(UINT64 val)
+{
+   return bswap_64(val);
+}
+#endif
+
+/**
  * Swap bytes in INT16 array or UCS-2 string
  * Length -1 causes stop at first 0 value
  */
index 52e0bf1..6a8dbcc 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\alarm_category.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\ap_config.cpp"
                                >
                        </File>