Hi, @jj Are you refering to NO_DYNAMIC_EXECUTION ?
We recently removed the compatibility check with embind when it is activated : https://github.com/kripken/emscripten/pull/5416 This was based on the absence of eval in the embind source code, but I didn't check new Function(), so maybe that was a little hasty. @Mitchell The ES6 solution seems fine, but it should only be used when NO_DYNAMIC_EXECUTION was explicitly requested IMO. Feel free to make a PR :) Le mardi 15 août 2017 08:32:03 UTC+2, jj a écrit : > > Pull requests are welcome. We do already have such a linker flag, > called -s NO_EVAL=1, but Embind has not been compatible with it. If > you'd like, feel free to work on expanding Embind to support such a -s > NO_EVAL=1 build mode. > > 2017-08-14 21:39 GMT+03:00 Mitchell Foley <[email protected] > <javascript:>>: > > Currently, embind.js makes use of the function constructor here and > here. It > > looks like this is used in order to dynamically create named functions. > > However certain environments, such as chrome apps, do not allow the use > of > > the function constructor without additional permissions or overhead. I > have > > a two suggestions on how this could be improved. > > > > A flag could be passed at compile time to generate these functions > without > > names. This would make debugging harder when the flag is on because > there > > wouldn't be named functions anymore, but if it means getting embind to > work > > in situations where it currently doesn't, this is an improvement. > > > > If ES6 code is allowed in embind.js, functions can be dynamically named > > using ES6 syntax. For example, the first use of new Function could be > > replaced with this: > > > > $createNamedFunction: function(name, body) { > > name = makeLegalFunctionName(name); > > return function() { > > var obj = { > > [name]: function() { > > "use strict"; > > return body.apply(this, arguments); > > } > > }; > > return obj[name]; > > }(); > > }, > > > > If either of these sound reasonable, I'm happy to make these changes > myself. > > > > Thanks, > > > > -Mitch > > > > -- > > 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] <javascript:>. > > 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.
