I'm trying to build a simple DLL on Windows that wraps _aligned_alloc, _aligned_realloc, and _aligned_free, using the cl command-line tools. My source file is a .c file, includes <stdlib.h> and <malloc.h>, and seems to compile OK with:
cl /LD CustomAllocators.c /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib
but then fails to link, showing:
CustomAllocators.obj : error LNK2019: unresolved external symbol _aligned_alloc referenced in function Allocate
CustomAllocators.dll : fatal error LNK1120: 1 unresolved externals
All those /NODEFAULTLIB switches are the result of much googling, and seem like they ought to do it, unless these allocation functions just aren't in any of those standard libraries... but in that case, I have no idea where they might be.
Can anyone tell me what library I need to include to resolve these symbols, or if there's something else I might be doing wrong?