Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
-4
rated 0 times [  2] [ 6]  / answers: 1 / hits: 28583  / 7 Years ago, thu, april 13, 2017, 12:00:00

I have a task to make simple c++ app which stores information into binary files, then need to make simple manipulations with this info, like edit,delete,read.
I wanted to create desktop app using Electron for designing UI and to use c++ for manipulation with information.



Is it possible and how can i include c++ into electron, is there any tutorials?
Thanks in advance.


More From » c++

 Answers
17

Electron is using nodejs, so you can still package cpp code as a node module and then use it as dependency in your electron app.



See the Hello World example here which basically does this:



module.exports.hello = () => 'world';


This is the example from their tutorial:



// hello.cc
#include <node.h>

namespace demo {

using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;

void Method(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
args.GetReturnValue().Set(String::NewFromUtf8(isolate, world));
}

void init(Local<Object> exports) {
NODE_SET_METHOD(exports, hello, Method);
}

NODE_MODULE(addon, init)

} // namespace demo

[#58159] Tuesday, April 11, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
adrianobeds

Total Points: 558
Total Questions: 118
Total Answers: 116

Location: Luxembourg
Member since Tue, Jan 25, 2022
2 Years ago
;