1
0
mirror of https://git.code.sf.net/p/mingw-w64/mingw-w64 synced 2025-04-18 17:44:18 +03:00

crt: Provide _aligned_* functions

Functions _aligned_free(), _aligned_malloc(), _aligned_offset_malloc(),
_aligned_offset_realloc() and _aligned_realloc() are available since
msvcr70.dll. For older CRT import libraries provide emulation via
mingw functions __mingw_aligned_free(), __mingw_aligned_malloc(),
__mingw_aligned_offset_malloc(), __mingw_aligned_offset_realloc() and
__mingw_aligned_realloc(). msvcrt.dll will use system implementation if
available, otherwise transparently fallback to mingw version.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Pali Rohár 2025-04-08 00:20:43 +02:00 committed by Martin Storsjö
parent ecf5fdb410
commit a91e27b3d9
7 changed files with 105 additions and 5 deletions

View File

@ -513,6 +513,11 @@ src_msvcrt32=\
misc/__p__osplatform.c \
misc/__pctype_func.c \
misc/__pwctype_func.c \
misc/_aligned_free.c \
misc/_aligned_malloc.c \
misc/_aligned_offset_malloc.c \
misc/_aligned_offset_realloc.c \
misc/_aligned_realloc.c \
misc/_create_locale.c \
misc/_free_locale.c \
misc/_get_current_locale.c \
@ -783,6 +788,11 @@ src_pre_msvcr70=\
misc/___mb_cur_max_func.c \
misc/__pctype_func.c \
misc/__pwctype_func.c \
misc/_aligned_free.c \
misc/_aligned_malloc.c \
misc/_aligned_offset_malloc.c \
misc/_aligned_offset_realloc.c \
misc/_aligned_realloc.c \
misc/lc_locale_func.c \
misc/strtoimax.c \
misc/strtoumax.c \

View File

@ -1202,11 +1202,11 @@ __crtLCMapStringW
F_NON_I386(__iob_func) ; i386 __iob_func replaced by alias
F_NON_I386(__pctype_func) ; i386 __pctype_func replaced by emu
__wcserror
_aligned_free
_aligned_malloc
_aligned_offset_malloc
_aligned_offset_realloc
_aligned_realloc
F_NON_I386(_aligned_free) ; i386 _aligned_free replaced by emu
F_NON_I386(_aligned_malloc) ; i386 _aligned_malloc replaced by emu
F_NON_I386(_aligned_offset_malloc) ; i386 _aligned_offset_malloc replaced by emu
F_NON_I386(_aligned_offset_realloc) ; i386 _aligned_offset_realloc replaced by emu
F_NON_I386(_aligned_realloc) ; i386 _aligned_realloc replaced by emu
_cgetws
_cputws
_cwprintf

View File

@ -0,0 +1,18 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <malloc.h>
static void __cdecl emu__aligned_free(void *memory)
{
__mingw_aligned_free(memory);
}
#define RETT void
#define FUNC _aligned_free
#define ARGS void *memory
#define CALL memory
#include "msvcrt_or_emu_glue.h"

View File

@ -0,0 +1,18 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <malloc.h>
static void * __cdecl emu__aligned_malloc(size_t size, size_t alignment)
{
return __mingw_aligned_malloc(size, alignment);
}
#define RETT void *
#define FUNC _aligned_malloc
#define ARGS size_t size, size_t alignment
#define CALL size, alignment
#include "msvcrt_or_emu_glue.h"

View File

@ -0,0 +1,18 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <malloc.h>
static void * __cdecl emu__aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
{
return __mingw_aligned_offset_malloc(size, alignment, offset);
}
#define RETT void *
#define FUNC _aligned_offset_malloc
#define ARGS size_t size, size_t alignment, size_t offset
#define CALL size, alignment, offset
#include "msvcrt_or_emu_glue.h"

View File

@ -0,0 +1,18 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <malloc.h>
static void * __cdecl emu__aligned_offset_realloc(void *memory, size_t size, size_t alignment, size_t offset)
{
return __mingw_aligned_offset_realloc(memory, size, alignment, offset);
}
#define RETT void *
#define FUNC _aligned_offset_realloc
#define ARGS void *memory, size_t size, size_t alignment, size_t offset
#define CALL memory, size, alignment, offset
#include "msvcrt_or_emu_glue.h"

View File

@ -0,0 +1,18 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <malloc.h>
static void * __cdecl emu__aligned_realloc(void *memory, size_t size, size_t alignment)
{
return __mingw_aligned_realloc(memory, size, alignment);
}
#define RETT void *
#define FUNC _aligned_realloc
#define ARGS void *memory, size_t size, size_t alignment
#define CALL memory, size, alignment
#include "msvcrt_or_emu_glue.h"