From e0c40c1c59014ffd193ee7cad44aae624103018a Mon Sep 17 00:00:00 2001 From: tbeu Date: Mon, 23 Jun 2014 15:44:31 +0200 Subject: [PATCH 1/2] fix type bool and inline specifier For a pure C compilation with MSVC type bool is not available. Not tested with other targets (Mingw, cygwin). Thats why only active of ```_MSC_VER``` is defined. So not sure if the bool fix should be also applied to other targets. For MSVC the inline specifier is not valid and must be named __inline (or _inline). --- src/msgpack.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/msgpack.h b/src/msgpack.h index 08f27688..40cc3e9f 100644 --- a/src/msgpack.h +++ b/src/msgpack.h @@ -20,6 +20,19 @@ * @{ * @} */ +#if !defined(__cplusplus) && defined(_MSC_VER) +#if !defined(FALSE) +#define FALSE (0) +#endif +#if !defined(TRUE) +#define TRUE (!FALSE) +#endif +#define bool int +#define true TRUE +#define false FALSE +#define inline __inline +#endif + #include "msgpack/object.h" #include "msgpack/zone.h" #include "msgpack/pack.h" From 751a6f98fee1d2d23ecbab539f2c8b6be2e42919 Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Wed, 2 Jul 2014 17:24:11 +0900 Subject: [PATCH 2/2] Moved bool and inline definition from msgpack.h to sysdep.h. Set compile settiong on MSVC. ".c" files are compliled as C, not C++. (msgpack_vc8.vcproj, CMakeLists.txt) Fixed msgpack root object initialization problem on MSVC. {} initialization is not supported on MSVC. --- CMakeLists.txt | 4 --- msgpack_vc8.vcproj | 80 -------------------------------------------- src/msgpack.h | 12 ------- src/msgpack/sysdep.h | 13 +++++++ src/unpack.c | 2 +- 5 files changed, 14 insertions(+), 97 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9946708f..d938e462 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,10 +99,6 @@ IF (MSGPACK_ENABLE_CXX) ) ENDIF () -IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - SET_SOURCE_FILES_PROPERTIES(${msgpack_SOURCES} PROPERTIES LANGUAGE CXX) -ENDIF () - EXECUTE_PROCESS ( COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/src/msgpack ) diff --git a/msgpack_vc8.vcproj b/msgpack_vc8.vcproj index 72d47b6b..8f3f4a67 100644 --- a/msgpack_vc8.vcproj +++ b/msgpack_vc8.vcproj @@ -159,102 +159,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = d; return 0; }