JSON_C_MICRO_VERSION)
#define JSON_C_VERSION "0.13.99"
+#ifndef JSON_EXPORT
+#if defined(_MSC_VER)
+#define JSON_EXPORT __declspec(dllexport)
+#else
+#define JSON_EXPORT extern
+#endif
+#endif
+
/**
* @see JSON_C_VERSION
* @return the version of the json-c library as a string
*/
-const char *json_c_version(void); /* Returns JSON_C_VERSION */
+JSON_EXPORT const char *json_c_version(void); /* Returns JSON_C_VERSION */
/**
* The json-c version encoded into an int, with the low order 8 bits
* @see JSON_C_VERSION_NUM
* @return the version of the json-c library as an int
*/
-int json_c_version_num(void); /* Returns JSON_C_VERSION_NUM */
+JSON_EXPORT int json_c_version_num(void); /* Returns JSON_C_VERSION_NUM */
#endif
#define JSON_C_CONST_FUNCTION(func) func
#endif
+#ifndef JSON_EXPORT
#if defined(_MSC_VER)
#define JSON_EXPORT __declspec(dllexport)
#else
#define JSON_EXPORT extern
#endif
+#endif
#include <stddef.h>
#include "json_inttypes.h"
#include <stddef.h>
+#ifndef JSON_EXPORT
+#if defined(_MSC_VER)
+#define JSON_EXPORT __declspec(dllexport)
+#else
+#define JSON_EXPORT extern
+#endif
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
*
* @return json_object_iterator
*/
-struct json_object_iterator
+JSON_EXPORT struct json_object_iterator
json_object_iter_init_default(void);
/** Retrieves an iterator to the first pair of the JSON Object.
*
* @endcode
*/
-struct json_object_iterator
+JSON_EXPORT struct json_object_iterator
json_object_iter_begin(struct json_object* obj);
/** Retrieves the iterator that represents the position beyond the
* (i.e., NOT the last pair, but "beyond the last
* pair" value)
*/
-struct json_object_iterator
+JSON_EXPORT struct json_object_iterator
json_object_iter_end(const struct json_object* obj);
/** Returns an iterator to the next pair, if any
* of json_object_iter_end() for the same JSON Object
* instance.
*/
-void
+JSON_EXPORT void
json_object_iter_next(struct json_object_iterator* iter);
* deleted or modified, and MUST NOT be modified or
* freed by the user.
*/
-const char*
+JSON_EXPORT const char*
json_object_iter_peek_name(const struct json_object_iterator* iter);
* the JSON Null value as a NULL json_object instance
* pointer.
*/
-struct json_object*
+JSON_EXPORT struct json_object*
json_object_iter_peek_value(const struct json_object_iterator* iter);
* reference the same name/value pair or are both at
* "end"); zero if they are not equal.
*/
-json_bool
+JSON_EXPORT json_bool
json_object_iter_equal(const struct json_object_iterator* iter1,
const struct json_object_iterator* iter2);
*
* @return negative if an error (or not found), or 0 if succeeded
*/
-int json_pointer_get(struct json_object *obj, const char *path, struct json_object **res);
+JSON_EXPORT int json_pointer_get(struct json_object *obj, const char *path, struct json_object **res);
/**
* This is a variant of 'json_pointer_get()' that supports printf() style arguments.
*
* @return negative if an error (or not found), or 0 if succeeded
*/
-int json_pointer_getf(struct json_object *obj, struct json_object **res, const char *path_fmt, ...);
+JSON_EXPORT int json_pointer_getf(struct json_object *obj, struct json_object **res, const char *path_fmt, ...);
/**
* Sets JSON object 'value' in the 'obj' tree at the location specified
*
* @return negative if an error (or not found), or 0 if succeeded
*/
-int json_pointer_set(struct json_object **obj, const char *path, struct json_object *value);
+JSON_EXPORT int json_pointer_set(struct json_object **obj, const char *path, struct json_object *value);
/**
* This is a variant of 'json_pointer_set()' that supports printf() style arguments.
*
* @return negative if an error (or not found), or 0 if succeeded
*/
-int json_pointer_setf(struct json_object **obj, struct json_object *value, const char *path_fmt, ...);
+JSON_EXPORT int json_pointer_setf(struct json_object **obj, struct json_object *value, const char *path_fmt, ...);
#ifdef __cplusplus
*
* See json_tokener_parse_ex() for an example of how to use this.
*/
-size_t json_tokener_get_parse_end(struct json_tokener *tok);
+JSON_EXPORT size_t json_tokener_get_parse_end(struct json_tokener *tok);
/**
*
* @return a generic error message is returned if an invalid error value is provided.
*/
-const char *json_tokener_error_desc(enum json_tokener_error jerr);
+JSON_EXPORT const char *json_tokener_error_desc(enum json_tokener_error jerr);
/**
* Retrieve the error caused by the last call to json_tokener_parse_ex(),
*
* Returns NULL on failure. See json_util_get_last_err() for details.
*/
-extern struct json_object* json_object_from_file(const char *filename);
+JSON_EXPORT struct json_object* json_object_from_file(const char *filename);
/**
* Create a JSON object from already opened file descriptor.
*
* Returns NULL on failure. See json_util_get_last_err() for details.
*/
-extern struct json_object* json_object_from_fd(int fd);
+JSON_EXPORT struct json_object* json_object_from_fd(int fd);
/**
* Equivalent to:
*
* Returns -1 if something fails. See json_util_get_last_err() for details.
*/
-extern int json_object_to_file(const char *filename, struct json_object *obj);
+JSON_EXPORT int json_object_to_file(const char *filename, struct json_object *obj);
/**
* Open and truncate the given file, creating it if necessary, then
*
* Returns -1 if something fails. See json_util_get_last_err() for details.
*/
-extern int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags);
+JSON_EXPORT int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags);
/**
* Convert the json_object to a string and write it to the file descriptor.
* @param flags flags to pass to json_object_to_json_string_ext()
* @return -1 if something fails. See json_util_get_last_err() for details.
*/
-extern int json_object_to_fd(int fd, struct json_object *obj, int flags);
+JSON_EXPORT int json_object_to_fd(int fd, struct json_object *obj, int flags);
/**
* Return the last error from various json-c functions, including:
* json_object_to_file{,_ext}, json_object_to_fd() or
* json_object_from_{file,fd}, or NULL if there is none.
*/
-const char *json_util_get_last_err(void);
+JSON_EXPORT const char *json_util_get_last_err(void);
-extern int json_parse_int64(const char *buf, int64_t *retval);
-extern int json_parse_double(const char *buf, double *retval);
+JSON_EXPORT int json_parse_int64(const char *buf, int64_t *retval);
+JSON_EXPORT int json_parse_double(const char *buf, double *retval);
/**
* Return a string describing the type of the object.
* e.g. "int", or "object", etc...
*/
-extern const char *json_type_to_name(enum json_type o_type);
+JSON_EXPORT const char *json_type_to_name(enum json_type o_type);
#ifdef __cplusplus
}
* Returns <0 if an error occurred during iteration, including if
* userfunc returned JSON_C_VISIT_RETURN_ERROR.
*/
-int json_c_visit(json_object *jso, int future_flags,
+JSON_EXPORT int json_c_visit(json_object *jso, int future_flags,
json_c_visit_userfunc *userfunc, void *userarg);
/**
#ifndef _printbuf_h_
#define _printbuf_h_
+#ifndef JSON_EXPORT
+#if defined(_MSC_VER)
+#define JSON_EXPORT __declspec(dllexport)
+#else
+#define JSON_EXPORT extern
+#endif
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
};
typedef struct printbuf printbuf;
-extern struct printbuf*
+JSON_EXPORT struct printbuf*
printbuf_new(void);
/* As an optimization, printbuf_memappend_fast() is defined as a macro
* Your code should not use printbuf_memappend() directly unless it
* checks the return code. Use printbuf_memappend_fast() instead.
*/
-extern int
+JSON_EXPORT int
printbuf_memappend(struct printbuf *p, const char *buf, int size);
#define printbuf_memappend_fast(p, bufptr, bufsize) \
*
* If offset is -1, this starts at the end of the current data in the buffer.
*/
-extern int
+JSON_EXPORT int
printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len);
/**
* printbuf_memappend()
* printbuf_strappend()
*/
-extern int
+JSON_EXPORT int
sprintbuf(struct printbuf *p, const char *msg, ...);
-extern void
+JSON_EXPORT void
printbuf_reset(struct printbuf *p);
-extern void
+JSON_EXPORT void
printbuf_free(struct printbuf *p);
#ifdef __cplusplus