Friday 28 September 2018

Could a node program be compiled to a C library?

npm nexe can compile a node.js program down to a single (node-independent) executable file, for any target architecture you want (within reason).I'm wondering if it's possible to make something similar, but instead of packaging a program into an executable file, package it into a shared library or DLL, such that a C client can call arbitrary functions that are exported from the node program (not just the main command-line entry point). (Obviously there would be a good amount of glue, marshaling parameters and return values and whatnot, but that could be abstracted away with a nice library.)If this were possible, it would allow us to create language bindings for node libraries.Does anyone understand how nexe works? And/or how possible/practical this idea is?

Submitted September 28, 2018 at 05:16PM by feugene

No comments:

Post a Comment