title: Racket as scripting language in a game engine
body: <p>I would like to add scripting capabilities to my C++ game engine.</p>
  
  <p>I have <code>Engine.exe</code>, <code>Physics.dll</code>, <code>Audio.dll</code> and I'm adding <code>Scripting.dll</code> which is a high-level Racket wrapper.</p>
  
  <p><code>Engine.exe</code> loads <code>Physics.dll</code> and sets up physics world, loads <code>Audio.dll</code> and sets up audio world. It is supposed to load <code>Scripting.dll</code>, to set up bindings to <code>Physics.dll</code>, <code>Audio.dll</code> and to load game scripts.</p>
  
  <p>AFAIK there are two possible ways to embed Racket into a C++ program:</p>
  
  <ul>
  <li><a href="http://docs.racket-lang.org/inside/Writing_Racket_Extensions.html">As Extension</a></li>
  <li><a href="http://docs.racket-lang.org/foreign/index.html">As Foreign Interface</a></li>
  </ul>
  
  <p>Using <a href="http://docs.racket-lang.org/foreign/index.html"><em>Foreign Interface</em></a> seems bizarre due to necessity to load <code>Physics.dll</code>, <code>Audio.dll</code> two times: first from <code>Engine.exe</code> and then from the game script.</p>
  
  <p>Writing <a href="http://docs.racket-lang.org/inside/Writing_Racket_Extensions.html"><em>Extensions</em></a> looks more appealing, because it allows doing script bindings on C++ side. On the other hand you have to build your extension with <code>raco ctool</code>, link it with <code>mzdyn</code> object file — which looks awkward as well: why not make <code>mzdyn</code> a static library?</p>
  
  <p>I would like to implement a single method, e.g. <code>setupScriptBindings()</code>, both in <code>Physics.dll</code> and in <code>Audio.dll</code>, and to call it from <code>Engine.exe</code> at the startup.</p>
  
  <p>Is there a straightforward way to do it?</p>