Indeed, see Pointer_stringify for transforming a char * containing a UTF8 string to a JS string, and intArrayFromString to convert the other way around: https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#call-compiled-c-c-code-directly-from-javascript
2015-03-06 1:27 GMT+02:00 Brion Vibber <[email protected]>: > I believe if you pass a char* directly it'll pass it as a numeric pointer. > You should then be able to extract that from the heap into a string on the > JS side via Module object in some semi-convenient way.... should be some > info on > https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html > > -- brion > > On Thu, Mar 5, 2015 at 3:14 PM, Stéphane Letz <[email protected]> wrote: > >> Hi, >> >> Can string (= char* buffers) be transferred to/from C code calling JS >> using the EM_ASM construct? >> >> Thanks >> >> Stéphane Letz >> >> -- >> 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. >> > > -- > 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. > -- 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.
