On Wed, 16 Dec 2009, Przemysław Czerpak wrote: Hi,
> Yes, it's and it was exploited in last year. I was cleaning the code > adding support for g++ about five years ago using xHarbour repository > and above RH7.3 with gcc-2.96 and for sure it was working correctly. Update. I've just checked that RH7.3 was used only in chroot env and the real OS I used was newer so I GCC C++ builds were never tested with GCC 2.9x. > Using C++ initialization (HB_STATIC_STARTUP) or recently added > HB_INITSEG_STARTUP it works. The problem is only with > __attribute__ ((constructor)) used in GCC-2.x C++ mode (I haven't > tested GCC-3.x). > I think that we exploited this problem in this year. > It possible that it's also the reason of problems with SunPRO C builds > in Linux, i.e. it GPFs in hbtest because not all constructors are executed > and some symbol tables from .prg modules in HBRTL are not initialized. > Anyhow it does not have to mean it's Harbour problem. It rather seems to > be side effect of exploiting some limits in older GCC or GNU ld versions > or maybe modified link command. I'll try to look at it closely but I do > not promise that I'll give you the exact answer what is the reason of > problem. The problem is trivial. GCC-2.96 when C++ mode is used ignores __attribute__ ((constructor)) and does not add functions with above attribute to .ctors segment. Looks like it was fixed in one of GCC-3.3x releases but I do not know the exact version. For sure it was fixed in the version I used adding g++. It will be good to check exact version to enable in hbinit.h HB_STATIC_STARTUP initialization for older GCC versions using C++ mode. Or maybe we should enable it by default for _ALL_ (also MSVC) compilers using C++ mode? Unlike all other startup initialization methods this one uses only standard C++ functionality without any compiler specific tricks so it's fully portable code in C++ world. best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour