
"Juergen Hunold" <hunold@ivembh.de> wrote in message news:200611092228.47355.hunold@ivembh.de...
Hi Gennadiy !
On Thursday 09 November 2006 21:08, Vladimir Prus wrote:
Gennadiy Rozental wrote:
Attached see version of class_properties_test.cpp that works both with static and dynamic libs
Yes, because it uses the AUTO_TEST framework. All other AUTO_TEST based tests in the whole boost work with static and dynamic linked UTF. That's not the deal :-((
My main problem is that I've got tests using the _old_ API (add test per test_suite->add(new custom_test_suite).
First of all I would recommend to use auto test tree generation as much as possible. It really makes your life easier. The problem you are expirience with dynamic library usage is caused by the fact that both default (empty) initialization routine and default function main() implementation are guarded in Boost.Test headers by the same flag BOOST_TEST_MAIN (you could have only init routine by defining BOOST_TEST_NO_MAIN, but you couldn't have function main() only). This is done to simplify life in most "common" case of automated test tree generation (at least it should be most common, since it's most simple and convinient. The fact that it's not yet true for Boost tests is unfortunate but irrelevant here). As an outcome of above once you want non-default init function (like in your case) you are also forced to implement the function main() yourself. Second part is init function interface change. In a long term I recommend switching to alternative init API even for tests that links with UTF statically. For dynamic library you are force to change interface immediately.
And the Boost tests use them, too. See my patch to Volodya making them explicitly link to the static UTF libraries...
And from all I've read I see no easy way of switching those _transparently_ from static to dynamic linking and back. By _tranparently_ I mean _without_ changing the sources (quite a lot) and adding some macros...
No. It's not transparent. But it's not that complecated either. Give it a try and let me know how did it work out for you. Once you switched to an alternative init API the only difference in dynamic/static compilation is function main in your test module. Gennadiy