- From: Borut Jegrisnik <borut@medianova.hr>
- Date: Tue, 30 May 2017 23:20:44 +0200
- To: public-webassembly@w3.org
- Message-ID: <CACLnnxj8gp_zcFE01zhjRCfP4WDJ5V_X+DJXf2f3C-Vaus9y5g@mail.gmail.com>
Hey all, I'm trying to get this simple scenario working, but I can't understand how to get the data from Memory: in hello.cpp: void EMSCRIPTEN_KEEPALIVE modifyDOM(const char *text, const char *id) { printf("modify dom %s with %s\n", id, text); EM_ASM_({ console.log($0); console.log($1); console.log(arguments); const elt = document.getElementById($0); elt.innerHTML = $1; }, id, text); } in hello.html: document.querySelector('.addDom').addEventListener('click', function(){ Module.ccall('modifyDOM', null, ['string', 'string'], ['Some fun text', 'textDom']); }); What I get is that printf outputs correct values (i.e. modify dom textDom with Some fun text) but the console.log outputs numbers like 6736 and 6672. I guess that's because inside Javascript world those values are stored like pointers in memory. If that's the case, what would be the best way to get those values as strings? And sub-question, is there a documentation on generated hello.js library? Many thanks Borut Jegrisnik
Received on Tuesday, 30 May 2017 21:22:51 UTC