Comments (6)
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.
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?
from nbind.
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.
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.
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.
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)
- Delay in handoff from C++ to Node awaiter
- nbind doesn't work with electron-packager
- Can't pass char* from JS to cpp function HOT 1
- Windows | EMCC should have a batch file too. (emcc-path)
- Is there any way to call javascript method from c++ HOT 1
- Use of `eval` violates Content Security Policy in browsers HOT 7
- Incompatible with electron 4 and later? HOT 4
- NBind not working with Node 12.0.0
- Release on Node12 HOT 9
- Fail to build with electron 5.0.8, deprecated methods
- Problem when using with proton native HOT 1
- Node 13 build errors HOT 2
- unresolved external
- unresolved external HOT 2
- sample app refuses to run
- npm i produces error "type-check is deprecated" and "Type 'string' cannot be used to index type 'ExportType'."
- Error while dooing fourth step HOT 5
- Iterator support?
- Is this project dead? HOT 2
- std::string support is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbind.