I'm facing problems with RapidJSON using on my embedded target. Under Windows everything works like a charm.
The following simple test does not work on my target:
#include "rapidjson/document.h"
#include "rapidjson/prettywriter.h"
#include "rapidjson/error/en.h"
using namespace rapidjson;
std::string temp = "{ \"Checksum\": 12345678912344567, \"Parameters\": [ 1, 2, 3 ] }" ;
Document json;
json.Parse( temp.c_str() );
if ( json.HasParseError() )
{
Logger::Log( Logger::ERROR, GetParseError_En( json.GetParseError() ),
"Read" );
return NULL;
}
if ( !json.IsObject() )
{
Logger::Log( Logger::ERROR, "Problems parsing the JSON file: " + filename,
"Read" );
return NULL;
}
The parsing doesn't return any error. If add an error the JSON, RapidJSON correctly reports the error (on the target, as well).
Get getting the type with json.GetType() returns 180 (dec) and IsInt64(), IsUint64() and IsDouble() return true.
Results of getters:
json.GetUint64() -> 269079258591236
json.GetInt64() -> 269079258591236
json.GetDouble() -> 0
My compiler flags:
gnu_arm_4.7.4_20130913/bin/arm-none-eabi-g++.exe -DBOOST_ALL_NO_LIB -DBOOST_HAS_STDINT_H \
-DBOOST_LEXICAL_CAST_ASSUME_C_LOCALE -DBOOST_NO_STD_LOCALE -DBSPCFG_ENABLE_CPP -DMQX_ENABLE_CPP \
-DMQX_SUPPRESS_FILE_DEF -DRAPIDJSON_HAS_STDSTRING -mcpu=cortex-a5 -mfloat-abi=hard -mfpu=neon-vfpv4 \
-g -D__MQXOS__ -D__GNU__ -D__STRICT_ANSI__ -nostdinc -mthumb -mthumb-interwork -mno-unaligned-access \
-fcommon -ffreestanding -fno-builtin -ftree-vectorize -DGTF_STATIC_BUILD -fvisibility=hidden -Wall \
-Wshadow -Wno-invalid-offsetof -Wuninitialized -fno-strict-aliasing -fshort-enums -fno-exceptions \
-fno-rtti -pipe -fPIC -O3 -DNDEBUG
The target OS is real time system called MQX from Freescale (now NXP).
Do you have any hints, what could be the problem?
Thanks