Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////// BINDINGS //////////////////////////////
- #include <emscripten/bind.h>
- using namespace emscripten;
- #include "score.h"
- Score::FileError loadScore(Score* score, char* filename, bool iv) {
- QString qstr(filename);
- return score->loadMsc(qstr, iv);
- }
- EMSCRIPTEN_BINDINGS(Score_bindings) {
- class_<QObject>("QObject")
- ;
- class_<QString>("QString")
- .constructor<char*>()
- ;
- enum_<Score::FileError>("FileError")
- .value("FILE_NO_ERROR", Score::FileError::FILE_NO_ERROR)
- .value("FILE_ERROR", Score::FileError::FILE_ERROR)
- .value("FILE_NOT_FOUND", Score::FileError::FILE_NOT_FOUND)
- .value("FILE_OPEN_ERROR", Score::FileError::FILE_OPEN_ERROR)
- .value("FILE_BAD_FORMAT", Score::FileError::FILE_BAD_FORMAT)
- .value("FILE_UNKNOWN_TYPE", Score::FileError::FILE_UNKNOWN_TYPE)
- .value("FILE_NO_ROOTFILE", Score::FileError::FILE_NO_ROOTFILE)
- .value("FILE_TOO_OLD", Score::FileError::FILE_TOO_OLD)
- .value("FILE_TOO_NEW", Score::FileError::FILE_TOO_NEW)
- .value("FILE_USER_ABORT", Score::FileError::FILE_USER_ABORT)
- ;
- class_<Score, base<QObject>>("Score")
- .constructor()// line: 447
- //.constructor<const MStyle *>()// line: 448
- //.constructor<Score *>()// line: 449
- //.function("loadMsc", &Score::loadMsc)// line: 594
- .function("loadScore", &loadScore, allow_raw_pointers())
- ;
- }
- ///////////////// compile command /////////////////////
- kyle@kyle-VirtualBox ~/Documents/emscripten-libmscore
- $ ../emscriptenqt/emscripten/emcc \
- > libmscore.bc \
- > QtGui.so QtCore.so \
- > --bind \
- > --post-js ../emscriptenqt/emscripten-qt/emscripten-stuff/pre-qt.js \
- > --js-library ../emscriptenqt/emscripten-qt/emscripten-stuff/pre-qt-library.js \
- > --embed-file qt-fonts \
- > --embed-file scores \
- > -s TOTAL_MEMORY=100108864 \
- > -o libmscore.js
- clang: warning: argument unused during compilation: '-nostdinc++'
- /////////////////// Javascript console input/output /////////////////////////
- > var score = new Module.Score()
- undefined
- > var result = score.loadScore("scores/Se_Canto.mscz", false)
- UnboundTypeError: Cannot call Score.loadScore due to unbound types: Pc
- message: "Cannot call Score.loadScore due to unbound types: Pc"
- name: "UnboundTypeError"
- stack: "UnboundTypeError: Cannot call Score.loadScore due to unbound types: Pc↵ at UnboundTypeError.<anonymous> (file:///home/kyle/Documents/emscripten-libmscore/libmscore.js:2581948:22)↵ at new UnboundTypeError (eval at createNamedFunction (file:///home/kyle/Documents/emscripten-libmscore/libmscore.js:2581969:12), <anonymous>:4:34)↵ at throwUnboundTypeError (file:///home/kyle/Documents/emscripten-libmscore/libmscore.js:2581882:11)↵ at Score.unboundTypesHandler [as loadScore] (file:///home/kyle/Documents/emscripten-libmscore/libmscore.js:2583125:13)↵ at <anonymous>:2:20↵ at Object.InjectedScript._evaluateOn (<anonymous>:562:39)↵ at Object.InjectedScript._evaluateAndWrap (<anonymous>:521:52)↵ at Object.InjectedScript.evaluate (<anonymous>:440:21)"
- __proto__: UnboundTypeError
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement