|
Boost : |
From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2006-02-11 16:05:54
Hello RObert,
----- Mensaje original -----
De: Robert Ramey <ramey_at_[hidden]>
Fecha: Sábado, Febrero 11, 2006 8:56 pm
Asunto: Re: [boost] [serialization] serialization/nvp.hppmakes
autolink kickin
> JOAQUIN LOPEZ MU?Z wrote:
> > Maybe the following:
> >
> > #include <boost/serialization/nvp.hpp>
> > // rest of serialization headers which must not trigger autolink
> > #include <...>
> >
> > int some_function_already present_in_serialization()
> > {
> > }
> >
> > int main(){}
> >
> > So, if autolink kicks in, the linker will complain about
> > a duplicate symbol.
>
> Hmmm - I wasn't aware that all linkers complain on duplicate symbols
> rather than just loading missing ones.
Well, you're right the std does not mandate that
a diagnostic be emitted in such case of ODR violation,
though most linkers will do.
Anyway, I thibk you can do it in a more robust
manner:
#include <boost/serialization/nvp.hpp>
// rest of serialization headers which must not trigger autolink
#include <...>
// declare some function of the serialization
// lib (which shouldn't be linked)
int some_f();
int main()
{
// use the function in whatever manner
int x=some_f();
}
Now, if autolink does not get activated, the
program should fail as some_f is not linked in.
So, in your Jamfile just mark this as a link-fail:
[ link-fail auto_link_not_invoked.cpp ]
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk