OK, it's not the virtual function. It's because this class is referenced in an other file just with "class GuidoParser;" and not with the include file definition.
Le mercredi 19 novembre 2014 17:02:44 UTC+1, [email protected] a écrit : > > Thanks, I try it and it work for my simple example. > > But in my project, the class has virtual methods (but no pure virtual)... > and I have now this error : > incomplete type 'GuidoParser' used in type trait expression > : public integral_constant<bool, __is_polymorphic(_Tp)> {}; > > Any idea ? > > Le mercredi 19 novembre 2014 16:13:00 UTC+1, jj a écrit : >> >> You can register that class without anything exposed on it, which will >> allow you to pass pointers to it around in a black-box manner. >> >> 2014-11-19 17:07 GMT+02:00 <[email protected]>: >> >>> 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. >>> >> >> -- 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.
