Skip to content Skip to sidebar Skip to footer

How To Pass Data From C++ Application To Javascript

I'm developing a jQuery-based pivot table. The goal is not a web app but a desktop-based application (C++). In my idea, data is retrieved by the application from the database, the

Solution 1:

If you don't want to add support for the http protocol to your application, and you don't want to write to additional files, then IMO your best bet is to create a wrapping http server for your application. Then the javascript page can access the running wrapper which can talk to your "real" application.

You could create such a server relatively easily in python using the twisted framework, ruby using rails and the bundled webrick server, or the v8 Javascript engine node.js. (I'm sure there's dozens of other options out there too)

Which of there would be best for you will depend a lot on which languages you have experience with and what your deployment requirements are (supported OSes, existing installed applications, installation size, license terms on your software etc.)

Solution 2:

Do you have a specific framework for your desktop app ? If you use Qt for the GUI, you can also integrate javascript quite easily.

http://efforts.embedded.ufcg.edu.br/qt/?p=84

Solution 3:

You might be able to use named pipes to pass data to a static page.

It might also be better to just make your c++ program into a simple web server which opens a port, and have it generate the web page when the user goes to http://localhost:8080.

Post a Comment for "How To Pass Data From C++ Application To Javascript"