diff --git a/Sming/Components/malloc_count/component.mk b/Sming/Components/malloc_count/component.mk index 7089c0962f..5579848cd1 100644 --- a/Sming/Components/malloc_count/component.mk +++ b/Sming/Components/malloc_count/component.mk @@ -29,6 +29,11 @@ MC_WRAP_FUNCS += \ pvPortZallocIram \ vPortFree endif +ifeq ($(SMING_ARCH)$(UNAME),HostWindows) +MC_WRAP_FUNCS += \ + __mingw_realloc \ + __mingw_free +endif EXTRA_LDFLAGS := $(call UndefWrap,$(MC_WRAP_FUNCS)) diff --git a/Sming/Components/malloc_count/malloc_count.cpp b/Sming/Components/malloc_count/malloc_count.cpp index 6766a8e46b..64e59cad86 100644 --- a/Sming/Components/malloc_count/malloc_count.cpp +++ b/Sming/Components/malloc_count/malloc_count.cpp @@ -373,6 +373,11 @@ extern "C" void* WRAP(pvPortZalloc)(size_t) __attribute__((alias("mc_zalloc"))); extern "C" void* WRAP(pvPortZallocIram)(size_t) __attribute__((alias("mc_zalloc"))); extern "C" void WRAP(vPortFree)(void*) __attribute__((alias("mc_free"))); +#elif defined(__WIN32) + +extern "C" void* WRAP(__mingw_realloc)(void*, size_t) __attribute__((alias("mc_realloc"))); +extern "C" void WRAP(__mingw_free)(void*) __attribute__((alias("mc_free"))); + #else void* operator new(size_t size) @@ -419,7 +424,7 @@ void operator delete[](void* ptr, size_t) #endif -#endif // ESP8266 +#endif extern "C" char* WRAP(strdup)(const char* s) {