I also met similar problems.
My problem is try to pass a user defined class reference using embind, but
there are compiler errors:
Code:
void func(Point3d& pt)
{ ...}
.function("func", &MyClass::func, allow_raw_pointers, pure_virtual())
Error:
*non-const lvalue reference to **type 'Point3d' cannot bind to a temporary
of type 'Point3d'*
Are there any methods to solve this problem?
On Tuesday, November 25, 2014 at 4:26:41 PM UTC+8, raytrace wrote:
>
> Hi I want to use embind to expose below function with reference as
> parameter, and build it using dmcc --bind flag,
>
> int testReference( int& input)
> {
> int ret = input;
> return ret;
> }
>
> EMSCRIPTEN_BINDINGS(my_module) {
>
> function("testReference", &testReference);
> }
>
> however I am facing the below errors:
>
> */Users/swd/Emscripten/emsdk_portable/emscripten/1.25.0/system/include/emscripten/bind.h:316:25:
>
> **error: *
>
> * non-const lvalue reference to type 'int' cannot bind to a temporary
> of type 'int'*
>
> internal::BindingType<Args>::fromWireType(args)...
>
> * ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
>
>
> Does Embind support functions with reference as parameter?
>
>
> Thanks,
>
>
>
--
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.