On Fri, Oct 5, 2012 at 11:02 AM, Graz <
gr...@rubli.biz> wrote:
> Hi everybody.
>
> Is there any way to create shared library with nodeJS to link agains other
> programs, written in (for example) C++?
>
> The reason why i need it is following:
> i have some functions written in javascript and i'm looking for
> availability to use these functions from other languages ( c++, python, perl
> ) without rewriting them in plain C.
>
> So i'm looking for possibility of creating a library with these functions (
> i use mostly linux, so in my case this must be a shared library .so file).
It should be possible to build node as a shared library though I
haven't tested that in recent times.
Open the node.gyp file and change the type of the 'node' target from
'executable' to 'shared_library'. You will need to remove node_main.cc
from the list of sources. Once compiled, node::Start() is your entry
point.
You will need additional plumbing if you want to call JS functions
directly from your C++/Python/Perl code.