[haiku-commits] Re: r40386 - haiku/trunk/src/libs/linprog

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 08 Feb 2011 11:18:05 +0100

On 2011-02-08 at 10:07:26 [+0100], clemens.zeidler@xxxxxxxxxxxxxx wrote:
> Author: czeidler
> Date: 2011-02-08 10:07:26 +0100 (Tue, 08 Feb 2011)
> New Revision: 40386
> Changeset: http://dev.haiku-os.org/changeset/40386
> 
> Modified:
>    haiku/trunk/src/libs/linprog/ActiveSetSolver.cpp
>    haiku/trunk/src/libs/linprog/LayoutOptimizer.cpp
>    haiku/trunk/src/libs/linprog/LayoutOptimizer.h
> Log:
> Don't copy the constraint list, just use a pointer to the list.
> 
> There was a strange crash under gcc4. After some searching I found out that 
> there is some clash with namespaces.
> After removing the namespaces it works again. Could somebody explain what 
> went wrong there?

It is important to keep in mind that with gcc 4 all exported symbols are 
preemptable. I.e. if two symbols with the same name are defined in libbe and 
libalm the same symbol will be used in all instances (the one defined in the 
library loaded earlier).

The best solution would be not to export any symbols by default (i.e. default 
to hidden visibility) and mark those that shall be exported explicitly. 
Unfortunately that works only with gcc 4, so a bit of messing with the build 
system and with preprocessor macros will be needed.

Alternatively simply use a namespace for your library that is different from 
the ones used in libbe (e.g. BPrivate::Layout is not a good choice).

CU, Ingo

Other related posts: