cheerp

How to preserve variable name in Cheerp (a C++ to JavaScript transpiler)

耗尽温柔 提交于 2020-06-25 21:48:58
问题 I'm using Cheerp (https://www.leaningtech.com/cheerp/) to transpile some C++ code into JavaScript. Is there any option to preserve variable names? Looks like the names get always mangled Original C++ code: void myClass::myMethod(int32_T myParam, boolean_T *rty_Result) { switch (myParam) { case Mycase1: case Mycase2: case Mycase3: case Mycase4: case Mycase5: *rty_Result = true; break; case Mycase6: *rty_Result = (filter.field1.field2 == 1); break; default: *rty_Result = false; break; } }

How to preserve variable name in Cheerp (a C++ to JavaScript transpiler)

与世无争的帅哥 提交于 2020-06-25 21:47:43
问题 I'm using Cheerp (https://www.leaningtech.com/cheerp/) to transpile some C++ code into JavaScript. Is there any option to preserve variable names? Looks like the names get always mangled Original C++ code: void myClass::myMethod(int32_T myParam, boolean_T *rty_Result) { switch (myParam) { case Mycase1: case Mycase2: case Mycase3: case Mycase4: case Mycase5: *rty_Result = true; break; case Mycase6: *rty_Result = (filter.field1.field2 == 1); break; default: *rty_Result = false; break; } }

How do I interface with extern variables from Cheerp/js?

烂漫一生 提交于 2020-06-17 08:03:08
问题 Cheerp is a C++ to js/wasm transpiler. Screeps is a programming videogame. How do I read in the Game.time variable from my transpiled C++ code? (in screeps) #include <cheerp/client.h> #include <iostream> using namespace std; namespace client { class Game : public Object { public: static volatile double time; }; extern volatile Game &Game; } void webMain() { cout << __TIME__ << ": The current time is: " << client::Game.time << endl; } I have tried any number of variations on: extern , volatile