Question

I want to make an app for which i need to include a part of my c++ code for calculation. For GUI i'm using HTML5. So is it possible to include C++ code into HTML5 ?

Was it helpful?

Solution

No. You can't do that. Try porting your C++ to JavaScript. You could take a look at this project that claims it can convert C++ code to JavaScript. I have never tried this myself.

Otherwise, you could write a CGI to use your C++ program and use AJAX to "remote execute it".

OTHER TIPS

It is not easily possible to use C++ code in HTML5; but it depends what you really want to do.

You should first understand what HTTP and HTML5 really are, and where you want the C++ code to run (in the browser - on the HTTP client side, or in the server - on the HTTP server side).

If you want to use C++ code on the client side (in the browser), you probably want something like Google Native Client. Not all browsers are supporting it, and your user needs to enable it. You could also consider compiling your C++ code to Javascript with Emscripten.

If you want C++ code on the server side, you may want to use CGI or FastCGI techniques, or make your C++ code a specialized HTTP server by using some HTTP server library (like libonion or Wt)

See also this question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top