Giter Site home page Giter Site logo

compilation fails about nbind HOT 6 CLOSED

charto avatar charto commented on May 14, 2024
compilation fails

from nbind.

Comments (6)

jjrv avatar jjrv commented on May 14, 2024

Did I understand correctly that you want to compile an executable which does not use Node.js, and include nbind.h and an NBIND_GLOBAL block but not have them do anything?

In that case just put #ifdef NBIND_GLOBAL around the NBIND_GLOBAL block so the preprocessor will remove it. Then make sure BUILDING_NODE_EXTENSION is not defined in the Makefile or Visual Studio project. Normally node-gyp will add it.

If instead you're trying to cross-compile a Node.js addon without the Node.js headers installed, the addon won't work.

from nbind.

ljubomirb avatar ljubomirb commented on May 14, 2024

Sorry for I was not clear. I'm indeed trying to compile c++ executable that is going to be used by node. But, I must compile separately. I do not know what node version will it be.
Also, exec must be able to run even if node is down. That is - exec will be started by system, and node will be or may not be started at all.
The way it is now is - I have exec listening low level perifery, then map key stuff to mqtt, and then - node (if running) is listening mqtt. I was just wandering if this way (with nbind) is with a bit less overhead, and also - it would give me more flexibility. If my idea of using it is correct.
However - I'm not able to compile ANY of your examples (as of today). I do see errors I described, looking like there is no library, but my #include path is there and no problem with it. I can post screenshot if that would help.
EDIT: to be clear - at the moment, I do not worry if node will start cpp exec or system, my only worry is that - I need to be able to compile exec separately, but I'm unable to do it now, so - is it because only npm install can do that, or - i'm missing something in every single example?
nbind

from nbind.

jjrv avatar jjrv commented on May 14, 2024

nbind is currently meant for Node.js addons which are actually libraries loaded with dlopen or similar. It's designed to also allow code using nbind to be linked into an executable. In that case, however, it won't do anything. It's important to use #ifdef NBIND_GLOBAL and #ifdef NBIND_CLASS around such blocks, because they will be undefined when compiling a normal executable.

There's simply no standard mechanism for your executable to communicate with Node.

I'm interested in adding a new communication channel that would work by sending binary messages in a standard format between C++ and JavaScript, and would somewhat fit your case. However, it's still in planning and unimplemented. Also, I was still planning the C++ code to run in the same process as Node.js. Your case sounds like it would involve some sort of inter-process communication. That's not entirely out of scope of nbind in the future, but in the near term there's nothing like that implemented.

from nbind.

jjrv avatar jjrv commented on May 14, 2024

If you have time and interest, I can help you extend nbind in the necessary ways, with the goal of adding the new code in the official repo. However, expect it to take several weeks of full-time work.

from nbind.

ljubomirb avatar ljubomirb commented on May 14, 2024

well, to be honest, I will use some other solution or approach, but I will send you my contact now, to see if I can help you in some way.

from nbind.

jjrv avatar jjrv commented on May 14, 2024

Thanks! I'll close this for now, then. A better solution will probably appear some day, but unfortunately not any time soon.

from nbind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.