10. embind class no member 类方法外部调用
#include <emscripten/bind.h> using namespace emscripten; class xClass { public: xClass(int x) : x(x) {}; int getVal (void) const { return x; } void setVal (int val) { x = val; } private: int x; }; void add (xClass &i, int x) { i.setVal(i.getVal() + x); } EMSCRIPTEN_BINDINGS(module) { class_<xClass>("xClass") .constructor<int>() .function("getVal", &xClass::getVal) .function("add", &add); }
假舆马者,非利足也,而致千里;假舟楫者,非能水也,而绝江河
浙公网安备 33010602011771号