Include C librairies in JavaScript compiled with NectarJS

JavaScript is cool, but if you want to manage memory (malloc) by hand, or integrate C libs, it's complicated. That's why we added in NectarJS an interface to directly include C code in JavaScript.

Get Started

Simply install NodeJS and install NectarJS :

npm install -g nectarjs

Once done, you can create a folder test and go in :

mkdir test && cd test

We are ready to import NectarJS examples :

nectar --example

The code

We want to compile the file c_interface.js, that include the c file test.c with the macro //!_c_include "c/test.c"

Compile and run

Let's compile and run that !

$ nectar --run c_interface.js

And the result is :

We are working hard on NectarJS and want to create a lot of interface to make it possible to hack and play with.