okay, thanks for your time explaining me the issue. Your solution now works 
on the example.
My next step is now to bind functions that return arrays.

Le mercredi 17 mai 2017 20:44:02 UTC+2, Alon Zakai a écrit :
>
> Looking into it, the issue is that (1) with async compilation, as 
> mentioned earlier, synchronously using lerp will fail. You need to wait for 
> it to be ready. And (2) without async compilation, we run into the problem 
> of needing the wasm module synchronously, and the page reports
>
> "On the web, we need the wasm binary to be preloaded and set on 
> Module['wasmBinary']. emcc.py will do that for you when generating HTML 
> (but not JS)"
>
> (That's a problem because the wasm is a side file, and we can't load it 
> synchronously on the web...)
>
> So solutions here are to either emit html and not js, or to not use lerp 
> synchronously, which is what I'd recommend. To use lerp when it is ready, 
> you can use this html:
>
> <!doctype html>
> <html>
>   <script>
>     var Module = {
>       onRuntimeInitialized: function() {
>         console.log('lerp result: ' + Module.lerp(1, 2, 0.5));
>       }
>     };
>   </script>
>   <script src="quick_example.js"></script>
> </html>
>
> The onRuntimeIntialized callback is called when the runtime is all ready 
> and compiled code is safe to be called.
>
> On Wed, May 17, 2017 at 1:17 AM, Romain Lvt <[email protected] 
> <javascript:>> wrote:
>
>> No it doesn't work with the following command : 
>> " emcc --bind -o quick_ex.html quick_ex.cpp -s WASM=1 -s 
>> BINARYEN_ASYNC_COMPILATION=0 " .
>> No warning either during the compilation. The only thing I did after 
>> compilation was adding:
>> " console.log(Module.lerp(1,2,0.5)) " to my html file. this is not 
>> recognized when the page is first loaded, but eventually it is recognized. 
>> So yes the problem of asynchonous compilation seems to be the cause. Do you 
>> think there is another way to get around this problem?
>> Thank you very much for your help
>>
>> Le mardi 16 mai 2017 18:44:56 UTC+2, Alon Zakai a écrit :
>>>
>>> It still doesn't work with -s WASM=1 -s BINARYEN_ASYNC_COMPILATION=0 , 
>>> but the function is eventually loaded later? That's strange, if it's an 
>>> async startup issue then disabling async compilation should fix it. Perhaps 
>>> there was a warning during compilation about something?
>>>
>>> On Tue, May 16, 2017 at 7:42 AM, Romain Lvt <[email protected]> wrote:
>>>
>>>> yes it works without wasm.
>>>> In fact the example is not done for wasm compilation, I was trying do 
>>>> adapt it.
>>>> When adding the option -s WASM=1 -s BINARYEN_ASYNC_COMP=0, I get the 
>>>> following messages :
>>>> "
>>>> TypeError: Module.lerp is not a function[Learn More]                
>>>> quick_example.html:1313:41
>>>> trying binaryen method: native-wasm               
>>>> quick_example.html:1249:13
>>>> [post-exception status] Preparing... (0/1)             
>>>> quick_example.html:1249:13
>>>> [post-exception status] All downloads complete.             
>>>> quick_example.html:1249:13
>>>> binaryen method succeeded.                      
>>>> quick_example.html:1249:13
>>>> [post-exception status] Running...                   
>>>> quick_example.html:1249:13
>>>> pre-main prep time: 31 ms
>>>> "
>>>>
>>>> Then,if I type in the console "Module.lerp", it is eventually loaded.
>>>>
>>>> Le lundi 15 mai 2017 18:49:46 UTC+2, Alon Zakai a écrit :
>>>>>
>>>>> Does it work without wasm? I think that example in the docs does not 
>>>>> support async compilation, which we do by default for wasm now. If so 
>>>>> building with -s BINARYEN_ASYNC_COMPILATION=0 might fix it, but in that 
>>>>> case, we should fix the example of course.
>>>>>
>>>>> On Mon, May 15, 2017 at 7:53 AM, Romain Lvt <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> hello , I tried to use embind following the first example of this 
>>>>>> tutorial "
>>>>>> https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html";
>>>>>>  
>>>>>> , using the webassembly option for the compilation "emcc -o 
>>>>>> quick_example.html -s WASM=1" but i get the following output error when 
>>>>>> trying to open the html file in the browser: "
>>>>>> run() called, but dependencies remain, so not running  
>>>>>> quick_ex.js:190:7
>>>>>> TypeError: Module.lerp is not a function[Learn More]  
>>>>>> quick_ex.html:12:35
>>>>>> pre-main prep time: 104 ms
>>>>>>
>>>>>> Does it mean that I missed a step in the compilation, or the binding ?
>>>>>>
>>>>>> Thank you.
>>>>>>
>>>>>> Le vendredi 4 novembre 2016 18:27:35 UTC+1, Alon Zakai a écrit :
>>>>>>>
>>>>>>> Yes, embind just needs the compiled code to be accessible and 
>>>>>>> runnable. It doesn't matter to it if that code is in asm.js or 
>>>>>>> WebAssembly 
>>>>>>> form.
>>>>>>>
>>>>>>> On Fri, Nov 4, 2016 at 4:00 AM, matthias <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> I have read some articles about Webassembly.
>>>>>>>> If I understand it right I can use emscripten to create 
>>>>>>>> webassembly. This is very nice, thank you.
>>>>>>>>
>>>>>>>> Is EMBIND also supported in this scenario? Can I use the exported 
>>>>>>>> EMBIND (Webassembly) classes from JavaScript?
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> 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.
>>>>>>
>>>>>
>>>>> -- 
>>>> 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] <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.

Reply via email to