I have embind code that does the following to return something from native to JS.
val ret = val::object(); if (status) { ret.set("transcodedImage", dst); } return ret; where dst is TranscodedImage* dst Since 4.0.9 I get (I've removed the backtrace from my code to the assertion statement) /emsdk/upstream/emscripten/cache/sysroot/include/emscripten/wire.h:124:19: error: static assertion failed due to requirement '!std::is_pointer<msc::TranscodedImage *>::value': Implicitly binding raw pointers is illegal. Specify allow_raw_pointer<arg<?>> 124 | static_assert(!std::is_pointer<T*>::value, "Implicitly binding raw pointers is illegal. Specify allow_raw_pointer<arg<?>>"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ... /src/interface/js_binding/transcoder_wrapper.cpp:277:21: note: in instantiation of function template specialization 'emscripten::val::set<char[16], msc::TranscodedImage *>' requested here 277 | ret.set("transcodedImage", dst); | ^ I cannot figure out how to specify `allow_raw_pointer`. I added `, allow_raw_pointers()` to the end of the function declaration in the EMSCRIPTEN_BINDINGS section but I got the same error. I have tried to use `allow_raw_pointer` template with TranscodedImage* as the arg in various ways but I am clearly not doing it the right way. I get a log of different errors. For example What is the right way? The documentation did not help. https://emscripten.org/docs/api_reference/bind.h.html#how-to-use-this-api just says "type allow_raw_pointer” under a heading of “Policies.” https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#embind does not even mention `allow_raw_pointer`. For reference the declaration of TranscodeImage is class TranscodedImage { public: TranscodedImage(size_t size) : image(size) { } uint8_t* data() { return image.data(); } size_t size() { return image.size(); } val get_typed_memory_view() { return val(typed_memory_view(image.size(), image.data())); } protected: std::vector<uint8_t> image; }; -- 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 emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/62902311-A081-4F3C-A2F1-389655F18E5E%40callow.im.
signature.asc
Description: Message signed with OpenPGP