6

I'm just getting into advanced C++ programming (object orientation), and I've been looking for hours on how to embed a C++ program into your average browser. I honestly have no idea how. I was thinking the same way you embed JavaScript with HTML using the script type tag. Can someone help me understand how to do this?

Justin C.
  • 63
  • 1
  • 3

3 Answers3

2

Unless you're using Chrome + Native client, you can forget about it...

There are many, many average browsers on the market out today, including mobile browsers which can't execute C++ code for variety of reasons.

So, I'd recommend staying with the usual suspects: Javascript and HTML 5 if you want to be standards compliant.

I strongly discourage using ActiveX, unless you're developing for a company intranet and all browsers in the company are IE 6. I hope you aren't in that scenario. Even then, I'd suggest staying away from ActiveX.

darioo
  • 46,442
  • 10
  • 75
  • 103
1

You mean, you want to run C++ into a browser ? No you can't for a lot of reason (The first and most important is the security)

May been soon with native code from Google...

Try http://code.google.com/p/nativeclient/

You have also ActiveX (a native client method created by Microsoft) but it sucks, it's hard to program and can only run under IE

Stef
  • 3,691
  • 6
  • 43
  • 58
  • yes :) and HTML5 too, Safer way. By the way things like Native Code from Google may be interesting in the future... But for now it is (very) experimental. You can try Flex too, but (in my opinion it sucks and you still cannot use native code inside) – Stef Dec 25 '10 at 08:42
0

You have at least two choices:

  • ActiveX (Microsoft browsers only)
  • NaCl (Google Native Client, still experimental)
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • 1
    What must I do with ActiveX? um..Sodium chloride? – Justin C. Dec 25 '10 at 08:35
  • 1
    Sodium chloride is a.k.a. "SALT" as in "Strategic Arms Limitations Treaty". Embedding native C++ code in a browser is limited technology because of its potential for mass destruction and thus falls under the purview of the various Strategic Arms treaties. – JUST MY correct OPINION Dec 25 '10 at 08:38