I've got some existing C++ code that does numerical processing within a stand-alone C++ application. I now want to use that code within a new node.js application.

Researching how to access C++ code from node.js, two options come up:

  1. Write a node.js extension
  2. Use node-ffi

node-ffi seems like a good option to access existing libraries, but am I right thinking if I use node-ffi I would have to write a C wrapper to make my C++ accessible? (This was the only way I could get a simple test case to work on Windows with Visual Studio).

For my case where my source code is already in C++, not C, what are the considerations in choosing between the two options above?

Edit
Report