Update. For Lib2Test.js, I tried to reverse the role of Side and Main 
module since Lib2 depends on lib1 it appears works better. I'll test a bit 
more and post my findings.

On Friday, January 17, 2014 9:11:38 PM UTC-6, Xiang Li wrote:
>
> Hi
>
>  
>
> I am new to Emscipten and I have been trying to use static linking (
> http://github.com/kripken/emscripten/wiki/Linking). My project has the 
> following directory structure:
>
>  
>
> FBProject
>
>                lib1
>
>                       source
>
>                                Lib1 .cpp snd .h files
>
>                        test
>
>                                lib1Test cpp files
>
>                lib2 
>
>                        source
>
>                                 Lib2 cpp and .h files
>
>                        test
>
>                                 lib2Test cpp files
>
>  
>
>               …
>
>  
>
>  
>
> Note lib2 is dependent on lib1.
>
>  
>
> Using Emscripten I can convert my project to JS successfully and both 
> lib1Test.js and lib2Test.js resulted run fine. Thanks for this amazing tool!
>
>  
>
> Now use static linking, this works:
>
>  
>
>     Build lib1 source files into a side module (Lib1Side.js) and lib1Ttest 
> files as a main module.  Link them together and the resulted Lib1Test.js 
> runs fine.
>
>  
>
> This does not work:
>
>  
>
> 1.     Build lib2 source files into a lib2.so, that is, in CMakeList.txt:
>
>   add_library(Lib2  SHARED lib2-source-files)
>
>  
>
> 2.     Build lib2Test files and lib2.so as the Main module, that is:
>
>   add_executable(Lib2TestMain Lib2Test-source-files)
>
>   target_link_libraries(Lib2TestMain Lib2)
>
>  
>
> 3.     Finally link the main module Lib2TestMain.js with Lib1Side.js 
> (note lib2 is dependent on lib1 in c++). It links fine and all symbols 
> appear resolved. But unfortunately the resulted lib2test.js does not run.
>
>  
>
> I suspect the side module Lib1Side.js is not relocated into 
> LIB2TestMain.js properly, perhaps some sort of static linking path should 
> be manipulated first? I can’t see why this won’t workL
>
>  
>
> I have been stuck on this several days. Any help or pointer will be 
> greatly appreciated.
>
>  
>
> Best regards
>
> Xiang Li
>

-- 
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/groups/opt_out.

Reply via email to