Zydis v4.1.1

Loading...
Searching...
No Matches
Defines.h
Go to the documentation of this file.
1/***************************************************************************************************
2
3 Zyan Disassembler Library (Zydis)
4
5 Original Author : Joel Hoener
6
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24
25***************************************************************************************************/
26
31
32#ifndef ZYDIS_DEFINES_H
33#define ZYDIS_DEFINES_H
34
35#include <Zycore/Defines.h>
36
37// This is a cut-down version of what CMake's `GenerateExportHeader` would usually generate. To
38// simplify builds without CMake, we define these things manually instead of relying on CMake
39// to generate the header.
40//
41// For static builds, our CMakeList will define `ZYDIS_STATIC_BUILD`. For shared library builds,
42// our CMake will define `ZYDIS_SHOULD_EXPORT` depending on whether the target is being imported or
43// exported. If CMake isn't used, users can manually define these to fit their use-case.
44
45// Backward compatibility: CMake would previously generate these variables names. However, because
46// they have pretty cryptic names, we renamed them when we got rid of `GenerateExportHeader`. For
47// backward compatibility for users that don't use CMake and previously manually defined these, we
48// translate the old defines here and print a warning.
49#if defined(ZYDIS_STATIC_DEFINE)
50# pragma message("ZYDIS_STATIC_DEFINE was renamed to ZYDIS_STATIC_BUILD.")
51# define ZYDIS_STATIC_BUILD
52#endif
53#if defined(Zydis_EXPORTS)
54# pragma message("Zydis_EXPORTS was renamed to ZYDIS_SHOULD_EXPORT.")
55# define ZYDIS_SHOULD_EXPORT
56#endif
57
61#if defined(ZYDIS_STATIC_BUILD)
62# define ZYDIS_EXPORT
63#else
64# if defined(ZYDIS_SHOULD_EXPORT)
65# define ZYDIS_EXPORT ZYAN_DLLEXPORT
66# else
67# define ZYDIS_EXPORT ZYAN_DLLIMPORT
68# endif
69#endif
70
74#define ZYDIS_NO_EXPORT
75
76#endif // ZYDIS_DEFINES_H