This would be a good case for using Native Addons for Node (nan). https://nodejs.org/api/n-api.html . You may be tempted to use the new C++ addons for node (https://nodejs.org/api/addons.html), but it's not API complete and spits annoying warnings (even with flags) so I'd suggest avoiding it.
The raw docs on nodejs.org are a bit hard to get started with, but I found this article helpful. I think it's still relevant. https://community.risingstack.com/using-buffers-node-js-c-plus-plus/ Also, the libsodium library has a bunch of macros that teach you how to do data conversion to/from node/C: https://github.com/paixaop/node-sodium/blob/master/src/include/node_sodium.h Best, Mikkel On Tuesday, December 19, 2017 at 12:07:00 AM UTC-8, Mike Aubury wrote: > > Hi, > I want to be able to communicate with a C program while maintaining stdio > streams as-is - sort of like the way NodeJS can send messages to child > nodejs programs. > > I can see in the documentation - i can use something like : > > > spawn('prg', [], { stdio: ['pipe', 'pipe', 'pipe', 'pipe' /* extra one > here */] }); > > > But - what do i need to do on the C side to link back to that new pipe ? > Do I need 2 pipes (one for read, one for write) > > Am I better trying to do something with IPC ? > > Any ideas, and/or code samples would be greatly appreciated ! > > > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/dda66f98-7987-4d4b-be03-0a7460b0bb17%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
