<?xml version="1.0"?>
<page id="version"
      type="guide"
      style="class"
      xmlns="http://projectmallard.org/1.0/"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/">

  <info>
    <link type="guide" xref="index#api-reference" />
  </info>

  <title>Libbson Versioning</title>
  <subtitle>Versioning Macros and Functions</subtitle>

  <p>
    The following preprocessor macros can be used to perform various checks based on the version of the library you are compiling against.
    This may be useful if you only want to enable a feature on a certain version of the library.
  </p>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[
#define BSON_CHECK_VERSION(major, minor, micro)

#define BSON_MAJOR_VERSION (1)
#define BSON_MINOR_VERSION (2)
#define BSON_MICRO_VERSION (0)
#define BSON_VERSION_S     "1.2.0"

#define BSON_VERSION_HEX (BSON_MAJOR_VERSION << 24 | \
                          BSON_MINOR_VERSION << 16 | \
                          BSON_MICRO_VERSION << 8)
]]></code></synopsis>
  </section>

  <listing>
    <title>Compile-Time Version Check</title>
    <desc>Only compile a block on Libbson 1.1.0 and newer.</desc>
    <code mime="text/x-csrc"><![CDATA[#if BSON_CHECK_VERSION(1, 1, 0)
static void do_something (void) {
}
#endif]]></code>
  </listing>

  <links type="topic" groups="function" style="2column">
    <title>Functions</title>
  </links>
</page>
