diff --git a/src/bindings/c/include/openvino/c/openvino.h b/src/bindings/c/include/openvino/c/openvino.h index f49a5049f7e..c534fc688d1 100644 --- a/src/bindings/c/include/openvino/c/openvino.h +++ b/src/bindings/c/include/openvino/c/openvino.h @@ -15,6 +15,12 @@ **/ #pragma once +#ifdef _WINDOWS_ +# pragma message( \ + "The BOOLEAN define in ov_element_type_e conflict with Windows.h BOOLEAN define. The BOOLEAN of ov_element_type_e redefine to OV_BOOLEAN here. If you want to use BOOLEAN of Windows.h, pls redefine befor include openvino/c/openvino.h, such as typedef BOOLEAN WIN_BOOLEAN") +#endif +#define BOOLEAN OV_BOOLEAN + #include "openvino/c/auto/properties.h" #include "openvino/c/ov_common.h" #include "openvino/c/ov_compiled_model.h" diff --git a/src/bindings/c/tests/ov_windows_conflict_test.cpp b/src/bindings/c/tests/ov_windows_conflict_test.cpp new file mode 100644 index 00000000000..07262bddeeb --- /dev/null +++ b/src/bindings/c/tests/ov_windows_conflict_test.cpp @@ -0,0 +1,26 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/* + * This test only for Windows, which caused by the BOOLEAN define conflict between Windows.h and openvino.h + * (ov_element_type_e). Sollution: 1) check Windows.h was used or not in openvino.h for windows OS 2) if YES, will + * redefine the "BOOLEAN" from Windows.h to "WIN_BOOLEAN" and also redefine the "BOOLEAN" from openvino.h to + * "OV_BOOLEAN" + */ + +#if defined(_WIN32) +# include +# include + +# include "openvino/c/openvino.h" + +# ifndef UNUSED +# define UNUSED(x) ((void)(x)) +# endif + +TEST(ov_windows_conflict_test, ov_windows_boolean_conflict) { + ov_element_type_e element_type = OV_BOOLEAN; // The BOOLEAN from ov_element_type_e will be replaced by OV_BOOLEAN + UNUSED(element_type); +} +#endif