diff --git a/build.rs b/build.rs index 0a1c96f3..7007508e 100644 --- a/build.rs +++ b/build.rs @@ -80,7 +80,13 @@ fn main() { .flag_if_supported("/std:c++17") .flag_if_supported("/O2") .flag_if_supported("/fp:fast") - .flag_if_supported("/W1"); // Reduce warnings verbosity + .flag_if_supported("/W1") // Reduce warnings verbosity + .flag_if_supported("/EHsc") + .flag_if_supported("/MD") + .flag_if_supported("/permissive-") + .flag_if_supported("/sdl-") + .define("_ALLOW_RUNTIME_LIBRARY_MISMATCH", None) + .define("_ALLOW_POINTER_TO_CONST_MISMATCH", None); } let mut result = build.try_compile("usearch"); diff --git a/rust/lib.cpp b/rust/lib.cpp index 87ee1d2c..9014decc 100644 --- a/rust/lib.cpp +++ b/rust/lib.cpp @@ -66,7 +66,7 @@ NativeIndex::NativeIndex(std::unique_ptr index) : index_(std::move(inde auto make_predicate(uptr_t metric, uptr_t metric_state) { return [=](vector_key_t key) { auto func = reinterpret_cast(metric); - auto state = reinterpret_cast(metric_state); + auto state = static_cast(metric_state); return func(key, state); }; } @@ -104,8 +104,8 @@ void NativeIndex::change_expansion_search(size_t n) const { index_->change_expan void NativeIndex::change_metric(uptr_t metric, uptr_t state) const { index_->change_metric(metric_punned_t::stateful( // - reinterpret_cast(metric), // - reinterpret_cast(state), // + static_cast(metric), // + static_cast(state), // index_->metric().metric_kind(), // index_->scalar_kind())); }