Home > The Unit Test Framework > User's guide > Usage variants > Dynamic library
PrevNext

The dynamic library variant of the UTF

In the project with large number of test modules the static library variant of the UTF may cause you to waste a lot of disk space, since the UTF is linked statically with every test module. The solution is to link with the UTF built into a dynamic library. If you opt to link a test module with the prebuilt dynamic library, this usage is called the dynamic library variant of the UTF. This variant requires you to define the flag BOOST_TEST_DYN_LINK either in a makefile or before the header boost/test/unit_test.hpp inclusion.
在含有大量測試模塊的工程中,使用 UTF靜態庫用法可能會浪費大量的磁盤空間,因為 UTF 會被靜態鏈接到每個測試模塊。 解決方案是鏈接到 UTF 生成的靜態庫。 如果選擇將測試模塊鏈接到預編譯的動態庫,這種用法被稱為 UTF 的動態庫用法。 這種用法需要在 makefile 或 boost/test/unit_test.hpp 頭文件之前定義標籤 BOOST_TEST_DYN_LINK

The test runner supplied with this variant requires you to implement the test module initialization function that matches the alternative initialization function signature. The UTF provides an ability to automatically generate an empty test module initialization function with correct signature if no custom initialization is required by a test module.
這種用法提供的測試運行器需要你實現匹配備選初始化函數簽名的測試模塊的初始化函數。 如果測試模塊不需要自定義的初始化,UTF 提供了自動生成空測試模塊初始化函數的能力。

[Note] Note

The name of the test module initialization function is not enforced, since the function is passed as an argument to the test runner.
測試模塊初始化函數的名稱不是強制的,因為這個函數將作為參數傳入到測試運行器中。


PrevUpHomeNext