From e68a91c8dfd86933deed87b75f9a4cbb6e8a2f39 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Tue, 25 Mar 2025 05:52:43 +0800 Subject: [PATCH] fixes usenimrtl with `useMalloc` (#24804) Follow up https://github.com/nim-lang/Nim/pull/19512 ref https://github.com/nim-lang/Nim/issues/24794 Otherwise, `/Users/blue/Desktop/Nim/lib/system/mm/malloc.nim(4, 1) Error: redefinition of 'allocImpl'; previous declaration here: /Users/blue/Desktop/Nim/lib/system/memalloc.nim(51, 8)` In `proc allocImpl*(size: Natural): pointer {.noconv, rtl, tags: [], benign, raises: [].}`, `rtl` means it is an `importc` function instead of a proc forward decl. (cherry picked from commit d15705e05b166077634a6caa96808d34af1f5d5b) --- lib/system/mmdisp.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim index 26f2f0bbf0..de82c0fb47 100644 --- a/lib/system/mmdisp.nim +++ b/lib/system/mmdisp.nim @@ -55,7 +55,8 @@ elif defined(gogc): include system / mm / go elif (defined(nogc) or defined(gcDestructors)) and defined(useMalloc): - include system / mm / malloc + when not defined(useNimRtl): + include system / mm / malloc when defined(nogc): proc GC_getStatistics(): string = ""