1 //  Copyright (c) 2007-2014 Hartmut Kaiser
2 //  Copyright (c)      2018 Nikunj Gupta
3 //
4 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
5 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef HPX_HPX_MAIN_HPP
8 #define HPX_HPX_MAIN_HPP
9 
10 #include <hpx/config.hpp>
11 #include <hpx/hpx_init.hpp>
12 
13 // We support different implementation depending upon the Operating
14 // System in use.
15 #if (HPX_HAVE_DYNAMIC_HPX_MAIN != 0) && \
16     (defined(__linux) || defined(__linux__) || defined(linux) || \
17     defined(__APPLE__))
18 
19 namespace hpx_start
20 {
21     // include_libhpx_wrap here is an override for the one present in
22     // src/hpx_wrap.cpp. The value of this variable defines if we need
23     // to change the program's entry point or not.
24     HPX_SYMBOL_EXPORT extern bool include_libhpx_wrap;
25     HPX_SYMBOL_EXPORT bool include_libhpx_wrap = true;
26 }
27 
28 #else
29 
30 #if defined(HPX_HAVE_STATIC_LINKING)
31 #include <hpx/hpx_main_impl.hpp>
32 #endif
33 
34 // We support redefining the plain C-main provided by the user to be executed
35 // as the first HPX-thread (equivalent to hpx_main()). This is implemented by
36 // a macro redefining main, so we disable it by default.
37 #define main hpx_startup::user_main
38 #endif
39 
40 #endif /*HPX_HPX_MAIN_HPP*/
41