xref: /reactos/sdk/include/ndk/section_attribs.h (revision 7eead935)
1 /*++ NDK Version: 0099
2 
3 Copyright (c) Alex Ionescu.  All rights reserved.
4 
5 Header Name:
6 
7     section_attribs.h
8 
9 Abstract:
10 
11     Preprocessor definitions to put code and data into the INIT section.
12 
13 Author:
14 
15     Timo Kreuzer (timo.kreuzer@reactos.org)
16 
17 --*/
18 
19 #pragma once
20 
21 #if defined(__GNUC__) || defined(__clang__)
22 
23 #define INIT_SECTION  __attribute__((section ("INIT")))
24 #define INIT_FUNCTION __attribute__((section ("INIT")))
25 
26 #elif defined(_MSC_VER)
27 
28 #pragma comment(linker, "/SECTION:INIT,ERW")
29 #define INIT_SECTION  __declspec(allocate("INIT"))
30 #if (_MSC_VER >= 1800) // Visual Studio 2013 / version 12.0
31 #define INIT_FUNCTION __declspec(code_seg("INIT"))
32 #else
33 #pragma section("INIT", read,execute,discard)
34 #define INIT_FUNCTION
35 #endif
36 
37 #else
38 
39 #error Invalid compiler!
40 
41 #endif
42