Subject: Re: [boost] Checking library binary compatibility with respect to compile time options
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-08-04 18:57:05
joel falcou wrote:
> I was pondering how to event or at least warn users when they use a .a
> compiled with a set of define with an
> application compiled with divergent options (like having different -D
> that may cause ODR violation).
> On IRC, I was linked to this page for MSVC 10:
> That defiens some pragma that exactly do that.
> However, it's MSVC 10 specific.
> After a few brainstorming, we ended up with a simple solution to
> emulate this.
> The code source is here:
> Here is a use case:
> g++ -c foo.cpp -o foo.o -I/usr/local/include/boost-1_43 -DGOOD_LIB
> g++ -c main.cpp -o bmain.o -I/usr/local/include/boost-1_43 -DBAD_LIB
> -I./ g++ -c main.cpp -o gmain.o -I/usr/local/include/boost-1_43 -DGOOD_LIB
> Here, we compiel foo with some settings and try to link it with two
> different setup for main.o
> The gcc output, showing the divergence in option is detected:
> g++ bmain.o foo.o -o bmain
> bmain.o: In function `__static_initialization_and_destruction_0(int,
> int)': main.cpp:(.text+0x2a): undefined reference to
> collect2: ld returned 1 exit status
> Of course, when you link the good pair of .o :
> g++ gmain.o foo.o -o gmain
> Nothing happens
> I guess some details need to be hammered out like visibility and such
> but could this be a valuable addition to boost (liek boost config for
> or have I overengineered something useless ?
I think this might be related to an idea I posted last may:
I'm not sure if this is the same or different
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk