<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="bson_writer_new">
  <info>
    <link type="guide" xref="bson_writer_t" group="function"/>
  </info>
  <title>bson_writer_new()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[bson_writer_t *
bson_writer_new (uint8_t         **buf,
                 size_t           *buflen,
                 size_t            offset,
                 bson_realloc_func realloc_func,
                 void             *realloc_func_ctx);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p><code>buf</code></p></td><td><p>A uint8_t.</p></td></tr>
      <tr><td><p><code>buflen</code></p></td><td><p>A size_t.</p></td></tr>
      <tr><td><p><code>offset</code></p></td><td><p>A size_t.</p></td></tr>
      <tr><td><p><code>realloc_func</code></p></td><td><p>A bson_realloc_func.</p></td></tr>
      <tr><td><p><code>realloc_func_ctx</code></p></td><td><p>A bson_realloc_func.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>Creates a new instance of <link xref="bson_writer_t">bson_writer_t</link> using the <code>buffer</code>, <code>length</code>, <code>offset</code>, and _realloc()_ function supplied.</p>
    <p>The caller is expected to clean up the structure when finished using <link xref="bson_writer_destroy">bson_writer_destroy()</link>.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>A newly allocated bson_writer_t.</p>
  </section>
</page>
