title: Call C++ library from Node.js (Node addons / node-ffi)
body: <p>I'm trying to integrate an external C++ library (I have access to the .so file as well as the header files) into my Node.js application. </p>
  
  <p>After a lot of research my options are reduced to:</p>
  
  <ol>
  <li><p>Writing a <a href="http://nodejs.org/api/addons.html" rel="noreferrer">Node addon</a> </p></li>
  <li><p>Use <a href="https://github.com/rbranson/node-ffi" rel="noreferrer">node-ffi</a></p></li>
  </ol>
  
  <p>From node-ffi's gitHub's definition I can't tell if it will or will not work directly on C++ libraries: </p>
  
  <blockquote>
    <p>node-ffi is a Node.js addon for loading and calling dynamic libraries using pure JavaScript. It can be used to create bindings to native libraries without writing any C++ code.</p>
  </blockquote>
  
  <p>So the questions I have are:</p>
  
  <ul>
  <li>Does option 1) imply rewriting in some way the external C++ library? </li>
  <li>Is node-ffi able to call directly to C++ libraries without any kind of C wrapper I'd have to write?</li>
  </ul>
  
  <p>I'm no expert when it comes to C/C++ so if I missed something basic for you to be able to answer please let me know so I can improve my question.</p>