Embedding NodeJs vs JXCore in Another Application

198 Views Asked by At

I'm looking to embed Node within another application that has a C/C++ interface. I'm aware that it can be done with Node, but it requires a bit of work to turn Node into a shared library rather than an executable. Would JXCore potentially be a better alternative for embedding within another application?

1

There are 1 best solutions below

0
karaxuna On

Code from sample repo:

JXValue result;
JX_Evaluate(
    "var arr = process.natives.sampleMethod('String Parameter', {foo:1}); \n"
    "console.log('result: ', arr, 'length:', arr.length ); \n"
    "setTimeout(function() { \n"
    "  console.log('end!'); \n"
    "}, 100);",
    "myscript", &result);

JX_Free(&result);