2

If you know tomcats jasper its jsp wrapper to java class, say I like to do something like this not web related just the general idea to JavaScript and c++, what I need to do? I mean
What technologies and book and article should I read? Where to start what concept to follow?

user63898
  • 29,839
  • 85
  • 272
  • 514

2 Answers2

2

I just recently found out about Node.js which might be what you are looking for. It allows JavaScript to be used outside browser and has capability to include C/C++ addons. More about in the API docs.

EDIT: If you want to use JavaScript as a build tool, then Jake should do it. It is direct port of Rake to JavaScript.

Laas
  • 5,978
  • 33
  • 52
  • can you control or create new c++ class? does it compile javascript to c++ code ? – user63898 Apr 07 '11 at 11:51
  • I havent yet used it myself, but what I have gathered, you can reuse what ever C/C++ stuff you have or create new classes. You only need to write a wrapper C++ class, that exports needed functionality to the JavaScript side. This is the same in many languages that support binary extensions written in C/C++. – Laas Apr 07 '11 at 13:40
  • i want something like java jasper , to compile the code to native exe after converting in to generic c++ code – user63898 Apr 08 '11 at 11:49
  • I think I misunderstood you - you want to compile JS to native, not access C++ classes from JS? If so, then [here](http://stackoverflow.com/questions/1118138/is-there-a-native-machine-code-compiler-for-javascript) are some ideas, but as that page also says - JS is very dynamic and you could miss out a lot of features, when trying to compile to static. – Laas Apr 08 '11 at 12:26
  • Thanks to the replay but this is NOT what i meant , i like to take JS as the logic script parse the end result to pure c++ code and compile it – user63898 Apr 09 '11 at 05:12
  • I updated my answer with a reference to Jake. Take a look at that. – Laas Apr 10 '11 at 08:06
1

You may want to try Lua. There are plenty of tutorials available, i.e. http://heavycoder.com/tutorials/lua_embed.php

Vladislav Zorov
  • 2,998
  • 19
  • 32