]>
Commit | Line | Data |
---|---|---|
1 | // (C) Copyright Gennadiy Rozental 2001. | |
2 | // Distributed under the Boost Software License, Version 1.0. | |
3 | // (See accompanying file LICENSE_1_0.txt or copy at | |
4 | // http://www.boost.org/LICENSE_1_0.txt) | |
5 | ||
6 | // See http://www.boost.org/libs/test for the library home page. | |
7 | // | |
8 | /// @file | |
9 | /// @brief Entry point for the end user into the Program Execution Monitor. | |
10 | /// | |
11 | /// Use this header to forward declare function prg_exec_monitor_main and to automatically define a main | |
12 | /// function for you. If you prefer to use your own main you are free to do so, but you need to define | |
13 | /// BOOST_TEST_NO_MAIN before incuding this header. To initiate your main program body execution you | |
14 | /// would use statement like this: | |
15 | /// @code ::boost::prg_exec_monitor_main( &my_main, argc, argv ); @endcode | |
16 | /// Also this header facilitate auto linking with the Program Execution Monitor library if this feature | |
17 | /// is supported | |
18 | // *************************************************************************** | |
19 | ||
20 | #ifndef BOOST_PRG_EXEC_MONITOR_HPP_071894GER | |
21 | #define BOOST_PRG_EXEC_MONITOR_HPP_071894GER | |
22 | ||
23 | #include <boost/test/detail/config.hpp> | |
24 | ||
25 | //____________________________________________________________________________// | |
26 | ||
27 | // ************************************************************************** // | |
28 | // ************** Auto Linking ************** // | |
29 | // ************************************************************************** // | |
30 | ||
31 | // Automatically link to the correct build variant where possible. | |
32 | #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \ | |
33 | !defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED) | |
34 | # define BOOST_LIB_NAME boost_prg_exec_monitor | |
35 | ||
36 | // If we're importing code from a dll, then tell auto_link.hpp about it: | |
37 | # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TEST_DYN_LINK) | |
38 | # define BOOST_DYN_LINK | |
39 | # endif | |
40 | ||
41 | # include <boost/config/auto_link.hpp> | |
42 | ||
43 | #endif // auto-linking disabled | |
44 | ||
45 | // ************************************************************************** // | |
46 | // ************** prg_exec_monitor_main ************** // | |
47 | // ************************************************************************** // | |
48 | ||
49 | namespace boost { | |
50 | ||
51 | /// @brief Wrapper around the main function | |
52 | /// | |
53 | /// Call this routine instead of your own main body implementation directly. This routine impements all the monitoring | |
54 | /// functionality. THe monitor behavior is configurable by using the environment variable BOOST_TEST_CATCH_SYSTEM_ERRORS. | |
55 | /// If set to string value "no", the monitor will not attempt to catch system errors (signals) | |
56 | /// @param[in] cpp_main main function body. Should have the same signature as regular main function | |
57 | /// @param[in] argc, argv command line arguments | |
58 | int BOOST_TEST_DECL prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] ); | |
59 | ||
60 | } // boost | |
61 | ||
62 | #if defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN) | |
63 | ||
64 | // ************************************************************************** // | |
65 | // ************** main function for tests using dll ************** // | |
66 | // ************************************************************************** // | |
67 | ||
68 | // prototype for user's cpp_main() | |
69 | int cpp_main( int argc, char* argv[] ); | |
70 | ||
71 | int BOOST_TEST_CALL_DECL | |
72 | main( int argc, char* argv[] ) | |
73 | { | |
74 | return ::boost::prg_exec_monitor_main( &cpp_main, argc, argv ); | |
75 | } | |
76 | ||
77 | //____________________________________________________________________________// | |
78 | ||
79 | #endif // BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN | |
80 | ||
81 | #endif // BOOST_PRG_EXEC_MONITOR_HPP_071894GER |