On Fri, 2006-12-29 at 17:30 +0000, Ludovico Cavedon wrote: > Being more specific: if the .o file containing the definition of a static > object > (eg: Logger::logger or String::EOL) is included both in the main code and in > a shared library, the object is still allocated once, but the constructor and > destructor are called twice on the same object. > > Note that that the intel compiler (9.1) has the same behavior as gcc. > I you want to try, I put a small testcase here: > http://netgroup.polito.it/~cavedon/obj.tgz > (testObj_sh is the executable who is working bad because of this problem).
I tried to do the same with Visual Studio 8: the result is that the static object is allocated twice. The code in the shared library was using one object, the other code was using the other object. The effect of this with Wengophone under Windows is that some static objects that should be unique, are doubled. An example is Logger. Under Windows there are multiple copies of the static object Logger::logger. I see 3 solutions: -build everything with static linking (anyway, what is the benefit of using shared libraries for wengophone code?) -make a new shared library that includes all the code needed by both shared libraries and main code; this should include Logger, String, ... -make sure every .c is included only once (e.g.: qtwengophone should not depend directly on Logger, but on libphapi, which includes Logger); anyway, I do not like this third solution :) What do you think? Regards, Ludovico _______________________________________________ Wengophone-devel mailing list [email protected] http://dev.openwengo.com/mailman/listinfo/wengophone-devel
