Skip to content

Commit d1be7d5

Browse files
committed
Fix: /EHc effect on exceptions in MSVC
1 parent 48ef5e8 commit d1be7d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/usearch/index.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,11 @@
120120

121121
extern "C" {
122122
/// @brief Helper function to simplify debugging - trace just one symbol - `__usearch_raise_runtime_error`.
123+
/// Assuming the `extern C` block, the name won't be mangled.
123124
inline static void __usearch_raise_runtime_error(char const* message) {
124-
#ifndef __cpp_exceptions
125+
// On Windows we compile with `/EHc` flag, which specifies that functions
126+
// with C linkage do not throw C++ exceptions.
127+
#if !defined(__cpp_exceptions) || defined(USEARCH_DEFINED_WINDOWS)
125128
std::terminate();
126129
#else
127130
throw std::runtime_error(message);

0 commit comments

Comments
 (0)