1 /***************************************************************************************************
3 Zyan Disassembler Library (Zydis)
5 Original Author : Joel Hoener
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:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
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
25 ***************************************************************************************************/
29 * Import/export defines for MSVC builds.
32 #ifndef ZYDIS_DEFINES_H
33 #define ZYDIS_DEFINES_H
35 #include "zydis/Zycore/Defines.h"
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.
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.
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
53 #if defined(Zydis_EXPORTS)
54 # pragma message("Zydis_EXPORTS was renamed to ZYDIS_SHOULD_EXPORT.")
55 # define ZYDIS_SHOULD_EXPORT
59 * Symbol is exported in shared library builds.
61 #if defined(ZYDIS_STATIC_BUILD)
64 # if defined(ZYDIS_SHOULD_EXPORT)
65 # define ZYDIS_EXPORT ZYAN_DLLEXPORT
67 # define ZYDIS_EXPORT ZYAN_DLLIMPORT
72 * Symbol is not exported and for internal use only.
74 #define ZYDIS_NO_EXPORT
76 #endif // ZYDIS_DEFINES_H