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.
---
 mingw-w64-crt/Makefile.am                    | 10 ++++++++++
 mingw-w64-crt/lib-common/msvcrt.def.in       | 10 +++++-----
 mingw-w64-crt/misc/_aligned_free.c           | 18 ++++++++++++++++++
 mingw-w64-crt/misc/_aligned_malloc.c         | 18 ++++++++++++++++++
 mingw-w64-crt/misc/_aligned_offset_malloc.c  | 18 ++++++++++++++++++
 mingw-w64-crt/misc/_aligned_offset_realloc.c | 18 ++++++++++++++++++
 mingw-w64-crt/misc/_aligned_realloc.c        | 18 ++++++++++++++++++
 7 files changed, 105 insertions(+), 5 deletions(-)
 create mode 100644 mingw-w64-crt/misc/_aligned_free.c
 create mode 100644 mingw-w64-crt/misc/_aligned_malloc.c
 create mode 100644 mingw-w64-crt/misc/_aligned_offset_malloc.c
 create mode 100644 mingw-w64-crt/misc/_aligned_offset_realloc.c
 create mode 100644 mingw-w64-crt/misc/_aligned_realloc.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 7f63ecb97b97..6d35f89211ae 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -517,6 +517,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 \
@@ -798,6 +803,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/_time64.c \
   misc/lc_locale_func.c \
   misc/strtoimax.c \
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in 
b/mingw-w64-crt/lib-common/msvcrt.def.in
index c989f6c3fa36..82694e41f7e8 100644
--- a/mingw-w64-crt/lib-common/msvcrt.def.in
+++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -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
diff --git a/mingw-w64-crt/misc/_aligned_free.c 
b/mingw-w64-crt/misc/_aligned_free.c
new file mode 100644
index 000000000000..eb4c36d8351a
--- /dev/null
+++ b/mingw-w64-crt/misc/_aligned_free.c
@@ -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"
diff --git a/mingw-w64-crt/misc/_aligned_malloc.c 
b/mingw-w64-crt/misc/_aligned_malloc.c
new file mode 100644
index 000000000000..51fca0763ad3
--- /dev/null
+++ b/mingw-w64-crt/misc/_aligned_malloc.c
@@ -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"
diff --git a/mingw-w64-crt/misc/_aligned_offset_malloc.c 
b/mingw-w64-crt/misc/_aligned_offset_malloc.c
new file mode 100644
index 000000000000..9a0dfd0a388a
--- /dev/null
+++ b/mingw-w64-crt/misc/_aligned_offset_malloc.c
@@ -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"
diff --git a/mingw-w64-crt/misc/_aligned_offset_realloc.c 
b/mingw-w64-crt/misc/_aligned_offset_realloc.c
new file mode 100644
index 000000000000..89c445a2f356
--- /dev/null
+++ b/mingw-w64-crt/misc/_aligned_offset_realloc.c
@@ -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"
diff --git a/mingw-w64-crt/misc/_aligned_realloc.c 
b/mingw-w64-crt/misc/_aligned_realloc.c
new file mode 100644
index 000000000000..7882bea5ee90
--- /dev/null
+++ b/mingw-w64-crt/misc/_aligned_realloc.c
@@ -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"
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to