It seems the issue we had was because we were generating .js file from each 
source file of the project.
Now we're generating byte code object, then combining them and then 
generating a .js file from the combined file.
Since we're only using one .js file, we don't have problem with multiple 
declarations of prerun(), run() and postrun().


Le jeudi 11 décembre 2014 18:58:04 UTC+1, Chad Austin a écrit :
>
> Hi,
>
> Does Emscripten support loading multiple Emscripten "executables" into one 
> page?  I can't think of anything in particular that would cause this to 
> break embind, but I'm not surprised either.  It's generally not a good idea 
> to include two "executables" in one page, because then you're duplicating 
> all the stdlib code, stack memory, and other base overhead.
>
> But if you genuinely need this to work, additional overhead 
> notwithstanding, maybe you can provide the specific errors that are causing 
> problems and we can go from there.
>
> Cheers,
> Chad
>
>
> On Thu, Dec 11, 2014 at 2:59 AM, Philippe Sengchanpheng <
> [email protected] <javascript:>> wrote:
>
>> Hello,
>>
>> I've been testing things with emscripten, especially using Embind to call 
>> C++ code from javascript.
>> With a test case such as the tutorial, it works ok.
>>
>> However, I tried with a project where I'm binding 2 base classes (let's 
>> say Toto and Tutu).
>> I get 2 files, Toto.js and Tutu.js.
>> If I use either of them separately in a test script, they work.
>> However, if I try to use both :
>>
>> <script src="Toto.js"></script>
>> <script src="Tutu.js"></script>
>> <script>
>> ... do toto stuff
>> ... do tutu stuff
>> </script>
>>
>> Then it doesn't work.
>> While checking around the 60k+ lines of each files, it seems some 
>> functions called prerun(), run() and postrun() are defined in each file.
>> And thus it might be that javascript doesn't like redefinition.
>>
>> Embind should work with multiple files, shouldn't it?
>> I searched for demos, but only found ones in a single file.
>>
>> I tried putting a separate binding file : 
>>
>> #include <emscripten/bind.h>
>> #include "emsLib/Tutu.hpp"
>> //#include "emsLib/Toto.hpp"
>>
>> EMSCRIPTEN_BINDINGS(Lib_test)
>> {
>>     emscripten::class_<Tutu>("Tutu")
>>         .constructor<int>()
>>         .yadayada
>>         ;
>>
>>     emscripten::class_<Toto>("Toto")
>>         .constructor<std::string>()
>>         .stuff
>>         ;
>> }
>>
>> But then I get warning about unresolved symbols, and functions that 
>> aren't exposed.
>>
>> I can't be the only one to use embind on multiple files in a project, 
>> what do I do wrong?
>> What am I supposed to do in that case?
>>
>> -- 
>> 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.
>>
>
>
>
> -- 
> Chad Austin
> Technical Director, IMVU
> http://engineering.imvu.com <http://www.imvu.com/members/Chad/>
> http://chadaustin.me
>
>
> 

-- 
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