Re: [boost] [serialization] serialization/nvp.hppmakes autolink kickin

Hello RObert, ----- Mensaje original ----- De: Robert Ramey <ramey@rrsd.com> 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

JOAQUIN LOPEZ MU?Z wrote:
Hello RObert,
----- Mensaje original ----- De: Robert Ramey <ramey@rrsd.com> 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 ]
I didn't know about link-fail - but I'm still missing something here. If I refer to a function that is declared in one of my headers - then auto-linking will be triggered. It doesn't matter whether this reference occurs by taking its address or by invoking it by name. Now I "think" bjam sets up a path to the directory that contains my pre-built boost libraries - so the reference will be found and and the program will link. Its not clear to me that I can suppress this and guarentee that the link will fail. Robert Ramey
participants (2)
-
JOAQUIN LOPEZ MU?Z
-
Robert Ramey