Pass complex C++ object to Javascript

276 views
Skip to first unread message

Artur

unread,
Jul 26, 2017, 7:19:55 AM7/26/17
to emscripten-discuss
Hello. In my WebAssembly application I have an instance of the following C++ class:

class MyData
{
public:
string str1, str2, str3;
vector<uint8_t> somevector;
};

MyData data;

I want to pass data object as an argument for JavaScript function

EM_ASM_({
    receiveData($0);
}, data);

But this doesn't work. Is there any other way to do this, without sending pointer and reading directly from wasm memory in JavaScript?

Alexandre Perrot

unread,
Aug 3, 2017, 5:49:12 AM8/3/17
to emscripten-discuss
Reply all
Reply to author
Forward
0 new messages