-
Notifications
You must be signed in to change notification settings - Fork 167
/
crt1.cpp
36 lines (31 loc) · 940 Bytes
/
crt1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2013 - 2020.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include <algorithm>
#include <iterator>
extern "C"
{
struct ctor_type
{
typedef void(*function_type)();
typedef std::reverse_iterator<const function_type*> const_reverse_iterator;
};
extern ctor_type::function_type _ctors_end[];
extern ctor_type::function_type _ctors_begin[];
}
namespace crt
{
void init_ctors();
}
void crt::init_ctors()
{
std::for_each(ctor_type::const_reverse_iterator(_ctors_end),
ctor_type::const_reverse_iterator(_ctors_begin),
[](const ctor_type::function_type pf)
{
pf();
});
}