Hi,
I try to pass object pointer argument to method of an embind class. The
objet pointer argument is not a embind class.
Here a example of code :
#include <emscripten.h>
#include <bind.h>
using namespace emscripten;
class A {
public:
A () {
a=5;
}
void add() {
a = a+1;
}
int get() {
return a;
}
private:
int a;
};
class B {
public:
B () {
b=10;
}
void add() {
b = b+1;
}
int get() {
return b;
}
A* getA() {
return new A;
}
void addA(A* a) {
b+=a->get();
}
private:
int b;
};
EMSCRIPTEN_BINDINGS(test) {
class_<B>("B")
.constructor<>()
.function("add",&B::add)
.function("get",&B::get)
.function("getA",&B::getA, allow_raw_pointers())
.function("addA",&B::addA, allow_raw_pointers())
;
}
My javascript code :
var B = new Module.B;
var A = B.getA();
B.addA(A);
I get the following error : "ReferenceError: getTypeName is not defined"
I suppose it's because the class A is not embind. I work with big class I
don't have to manipulate in javascript, I just have a pointer.
Is it possible to use pointer on class which are not embind ? (like cwrap
which return an integer for a pointer)
--
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.