Sorry for wrong link. http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects
среда, 23 сентября 2015 г., 23:22:52 UTC+8 пользователь Alexey Solovey написал: > > What you think about typed objects support/using with Emscripten? > http://wiki.ecmascript.org/doku.php?id=harmony:proxies > > I tried polyfill with Emscripten allocated memory. But I want native > browser support, for knowing what will with pointers. > > Sample JS: > > const Bike = new TypedObjects.StructType({ > top: TypedObjects.int32, > bottom: TypedObjects.int32 > }); > > var adr = Module._malloc(8); > var a = new Bike(Module.buffer, adr); > a.top = 100; > a.bottom = 10; > > var setObject = Module.cwrap('setObject', 'number', ['number']); > setObject(adr); > > Sample C: > > #include <stdio.h> > > typedef struct{ > int top; > int bottom; > } Bike; > > //Use pointer > Bike * getObject(int top, int bottom){ > Bike a; > a.top = top; > a.bottom = bottom; > Bike * b = &a; > return b; > } > > //Use pointer > void setObject(Bike * a){ > printf("%d\n", a->top); > printf("%d\n", a->bottom); > } > -- 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]. For more options, visit https://groups.google.com/d/optout.
