This seems to still be a problem. In fact, not only classes, but ordinary functions bound with EMSCRIPTEN_BINDINGS seem to disappear when using -O2 or higher. Has anyone else had this problem?
I can't find a filed bug for it. I'm happy to file one if it is in fact a bug. On Thursday, May 7, 2015 at 5:30:13 AM UTC-4, Björn K. wrote: > > Sorry for not providing accurate enough reproduction-steps. I've set up a > repository at github: https://github.com/cee-dee/emscripten-tests > Additionally I've created two issues which describe exactly what to do in > order to see the problems. > > The directory "embind-test-01" contains the problem which I mentioned > here, the directory "webidl-test-01" contains a reduced test where I > experimented with the webidl-binding, where I at least partially succeeded, > but still have the problem that --closure 1 won't produce usable results. > > Best regards, > Björn > > > Am Mittwoch, 6. Mai 2015 20:54:25 UTC+2 schrieb Alon Zakai: >> >> I can't reproduce the problem on that testcase, but maybe we are doing >> things a little differently (it doesn't build by itself). Can you please >> file a github issue with complete steps to reproduce? >> >> >> On Tue, May 5, 2015 at 5:44 AM, Björn K. <[email protected]> >> wrote: >> >>> Hi there! >>> >>> When using the sample c++ code from >>> >>> https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html#classes >>> it just works as long as I do not use the optimization -O2. >>> >>> When I compile with that option, my browser always tells me "TypeError: >>> Module.MyClass is not a constructor". In >>> https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#calling-compiled-c-functions-from-javascript-using-ccall-cwrap >>> >>> it sais "At higher optimisation levels (-O2 and above), the *closure >>> compiler* >>> <https://kripken.github.io/emscripten-site/docs/site/glossary.html#term-closure-compiler> >>> >>> runs and minifies (changes) function names. Exporting functions allows you >>> to continue to access them using the original name through the global >>> Module object.", so I tried using the option -s EXPORTED_FUNCTIONS, but >>> it seems to work only for functions, not classes. >>> >>> What am I doing wrong? Would it work to export global functions which >>> serve as constructors for my classes? Sounds like a hack to me... >>> >>> Best regards, >>> Björn >>> >>> >> -- 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.
