Thursday, December 29, 2011

64 bit integers in Jansson

Starting from version 2.0, Jansson supports 64 bit integers.

To enable 64 bit support, in jansson_config.h file set JSON_INTEGER_IS_LONG_LONG value to 1.

If you are using Visual C++ compiler, you will also need to define strtoll() function that is missing from Microsoft C runtime library.

#ifndef JANSSON_CONFIG_H
#define JANSSON_CONFIG_H

/* If your compiler supports the inline keyword in C, JSON_INLINE is
   defined to `inline', otherwise empty. In C++, the inline is always
   supported. */
#ifdef __cplusplus
#define JSON_INLINE inline
#else
#define JSON_INLINE
#endif

/* If your compiler supports the `long long` type,
   JSON_INTEGER_IS_LONG_LONG is defined to 1, otherwise to 0. */
#define JSON_INTEGER_IS_LONG_LONG 1

/* If locale.h and localeconv() are available, define to 1,
   otherwise to 0. */
#define JSON_HAVE_LOCALECONV 1

#ifdef _MSC_FULL_VER
#define snprintf _snprintf
#define strtoll _strtoi64
#endif

#endif

No comments:

Post a Comment