In general yes, except for when system libraries are involved, see the notes on the linking wiki page about that.
- Alon On Mon, Jan 20, 2014 at 10:03 PM, Xiang Li <[email protected]> wrote: > Thanks for the reply. I will try to make a testcase. It might be > difficult to come up with a good tescase since our code is quite large so I > will have to narrow down the root issue first. > > But according to the instructions reversing side module and main module > should not cause difference? No? > > -Xiang > > > > On Mon, Jan 20, 2014 at 11:16 PM, Alon Zakai <[email protected]> wrote: > >> The static linking code is fairly new and I don't think many people have >> tested it yet, so very possible you found a bug. Please try to make as >> small as possible a testcase and file an issue. >> >> - Alon >> >> >> >> On Sat, Jan 18, 2014 at 10:13 PM, Xiang Li <[email protected]>wrote: >> >>> 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. >>> >> >> -- >> 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. >> > > -- > 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. > -- 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.
