From 6834ccb2d513496c2e114760f60c145d416a58b4 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 22 Aug 2024 18:43:45 +0300 Subject: [PATCH] builtin,thirdparty: fix compilation of libgc with `-cc msvc -gc boehm` (thanks to @Ekopalypse) --- thirdparty/libgc/include/gc.h | 2 ++ vlib/builtin/builtin_d_gcboehm.c.v | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/thirdparty/libgc/include/gc.h b/thirdparty/libgc/include/gc.h index dab8ee8cec..e1ad0116e2 100644 --- a/thirdparty/libgc/include/gc.h +++ b/thirdparty/libgc/include/gc.h @@ -1,6 +1,8 @@ /* This file is installed for backward compatibility. */ #include "gc/gc.h" +#ifndef _MSC_VER __attribute__ ((weak)) GC_API void GC_CALL GC_noop1_ptr(volatile void *p) { GC_noop1((u64)p); } +#endif diff --git a/vlib/builtin/builtin_d_gcboehm.c.v b/vlib/builtin/builtin_d_gcboehm.c.v index 161a6de8fc..dcba2b8dec 100644 --- a/vlib/builtin/builtin_d_gcboehm.c.v +++ b/vlib/builtin/builtin_d_gcboehm.c.v @@ -114,7 +114,12 @@ $if gcboehm_leak ? { #flag -DGC_DEBUG=1 } +$if windows && msvc { + #flag ucrtd.lib +} + #include + // #include // replacements for `malloc()/calloc()`, `realloc()` and `free()`