Do you have to free strings passed to exported C functions in Emscripten? -
i found out through emscripten wiki (interacting code) c functions called javascript ccall or cwrap should have char* argument or homecoming type when beingness passed or returning string.
i not experienced in c (the rest of project written in c++) know have manually free dynamic strings in c. case when passing string javascript c function, , if so, how should done?
in cases can c++ code take care of memory allocation , freeing you. illustration if pass in literal string (in quotes), freed after function returns.
for variable strings, recommend utilize std::string (as do), , when pass emscripten function, phone call c_str() method on convert it.
for example:
my_js_function(my_string.c_str()); emscripten
No comments:
Post a Comment