Skip to content

C++ and Node.js: An Unholy Combination….But Oh So Right

Notifications You must be signed in to change notification settings

mguardarini/nodejs-bind-cplusplus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to create js binding to c/c++ library using nodejs FFI

This is a simple example C/C++ math library binding to Node.JS using addon FFI(foreign feth interface) and web server with express.

If you have an existing library written in C/C++ and you want to use this in a Node.JS application or you want to create an interface binding for javascript, you using 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.

To install dependency using NPM.

npm install

To Build the project

npm run build

To run the project

npm run start

Enjoy :)