Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript communicate with C++

Tags:

c++

javascript

I have a desktop application that has a C++ backend and a HTML5/JS front end. We are currently having to use Google V8 or Mac Webview and Objective-C to allow Javascript and C++ to communicate. Is there any way to have them directly talk to each other without the middleware?

Trying to accomplish:

  1. Share variables.
  2. Call Functions from C++ to JS.
  3. Call Functions from JS to C++.

I have tried googling this and everything points to the above solutions.

like image 450
Rob Avatar asked Feb 20 '13 05:02

Rob


1 Answers

You could try using Google's Protocol Buffers which allows you to create data objects that get compiled to C++ objects. You could then use one of the following projects from their wiki to use protobuffers with javascript:

  • https://github.com/sirikata/protojs
  • http://code.google.com/p/protobuf-js/
like image 133
Talon876 Avatar answered Oct 16 '22 10:10

Talon876