I am new at this, so don't laugh.

I am able to make C/C++ functions that javascript can call.  When the 
parameters are out only.

Can I make them return parameters?

Lets say I want to return a point.  Two values, x and y.
In C/C++ I would make my function look like:

void getFoo( float &x, float &y);

and have the implementation fill in the values for those two references. 
The caller could then read the values out of the variables they passed in.

How do I do a similar thing with WebAssembly and javascript?

At the moment, I am implementing the solution by having the WebAssembly 
code call back to javascript with the answer.  But that feels wrong in many 
ways.

Also, allocating a shared buffer to write to, feels wrong in this case.  
Since it happens on mouse move and all those memory allocations seem 
wasteful.

What is the right way to do this?

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/73244098-e837-46e7-892e-d39346405347%40googlegroups.com.

Reply via email to