<p dir="auto"><a href="https://github.com/crabtw/rust-bindgen">https://github.com/crabtw/rust-bindgen</a> is super cool and ought to be part of the toolset we distribute with rustc.</p>
<p dir="auto">It might be the right time to consider bundling libclang with rustc as well, for this reason as well as possibly other forms of integration (our driver, cargo, etc.)</p>
<p dir="auto">Make a pass that executes bindgen during the build.</p>
<p dir="auto">This would build the jsapi module automatically based on the header files:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#[bindgen(files(&quot;jsapi.h&quot;, &quot;jswhatever.h&quot;), name = &quot;jsapi&quot;)];"><pre class="notranslate"><code class="notranslate">#[bindgen(files("jsapi.h", "jswhatever.h"), name = "jsapi")];
</code></pre></div>
<p dir="auto">It would never generate any <code class="notranslate">.rs</code> files, just insert it directly into the AST.</p>