https://git.reactos.org/?p=reactos.git;a=commitdiff;h=379957424c80f7b616da5…
commit 379957424c80f7b616da5b4445efce2907834f20
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat Jul 31 17:15:30 2021 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Wed Aug 4 02:03:07 2021 +0200
[CRT] Fix some _CRTIMP
Get rid of the ugly __MINGW_IMP_SYMBOL hacks.
---
sdk/include/crt/mbctype.h | 14 ++--------
sdk/lib/crt/include/internal/mingw-w64/internal.h | 33 +++++------------------
sdk/lib/crt/startup/charmax.c | 2 +-
sdk/lib/crt/startup/crtexe.c | 19 ++-----------
4 files changed, 12 insertions(+), 56 deletions(-)
diff --git a/sdk/include/crt/mbctype.h b/sdk/include/crt/mbctype.h
index 7a7a709be85..53fc0f2c80a 100644
--- a/sdk/include/crt/mbctype.h
+++ b/sdk/include/crt/mbctype.h
@@ -22,20 +22,10 @@ extern "C" {
#endif /* defined (_DLL) && defined (_M_IX86) */
#endif
#ifndef _mbctype
-#ifdef _MSVCRT_
- extern unsigned char _mbctype[257];
-#else
-#define _mbctype (*_imp___mbctype)
- extern unsigned char **_imp___mbctype;
-#endif
+ _CRTIMP extern unsigned char _mbctype[257];
#endif
#ifndef _mbcasemap
-#ifdef _MSVCRT_
- extern unsigned char *_mbcasemap;
-#else
-#define _mbcasemap (*_imp___mbcasemap)
- extern unsigned char **_imp___mbcasemap;
-#endif
+ _CRTIMP extern unsigned char _mbcasemap[257];
#endif
/* CRT stuff */
diff --git a/sdk/lib/crt/include/internal/mingw-w64/internal.h
b/sdk/lib/crt/include/internal/mingw-w64/internal.h
index aeac86701ef..9193ab9c5b4 100644
--- a/sdk/lib/crt/include/internal/mingw-w64/internal.h
+++ b/sdk/lib/crt/include/internal/mingw-w64/internal.h
@@ -21,7 +21,7 @@ extern "C" {
#ifdef __REACTOS__
#include "malloc.h"
struct _exception;
-__declspec(dllimport) void __cdecl __setusermatherr(int (__cdecl *)(struct _exception
*));
+_CRTIMP void __cdecl __setusermatherr(int (__cdecl *)(struct _exception *));
#define __mingw_fprintf fprintf
#define __mingw_vfprintf vfprintf
#endif
@@ -82,13 +82,11 @@ __declspec(dllimport) void __cdecl __setusermatherr(int (__cdecl
*)(struct _exce
#define _tm_unicode_safe(i) (_pioinfo_safe(i)->unicode)
#ifndef __badioinfo
- extern ioinfo ** __MINGW_IMP_SYMBOL(__badioinfo)[];
-#define __badioinfo (* __MINGW_IMP_SYMBOL(__badioinfo))
+_CRTIMP extern ioinfo * __badioinfo[];
#endif
#ifndef __pioinfo
- extern ioinfo ** __MINGW_IMP_SYMBOL(__pioinfo)[];
-#define __pioinfo (* __MINGW_IMP_SYMBOL(__pioinfo))
+_CRTIMP extern ioinfo ** __pioinfo[];
#endif
#define _NO_CONSOLE_FILENO (intptr_t)-2
@@ -119,27 +117,10 @@ __declspec(dllimport) void __cdecl __setusermatherr(int (__cdecl
*)(struct _exce
extern int _dowildcard;
extern int _newmode;
-#ifndef __winitenv
-extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
-#define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv))
-#endif
-
-#ifndef __initenv
-extern char *** __MINGW_IMP_SYMBOL(__initenv);
-#define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
-#endif
-
-#ifndef _acmdln
-extern char ** __MINGW_IMP_SYMBOL(_acmdln);
-#define _acmdln (* __MINGW_IMP_SYMBOL(_acmdln))
-/* _CRTIMP extern char *_acmdln; */
-#endif
-
-#ifndef _wcmdln
-extern char ** __MINGW_IMP_SYMBOL(_wcmdln);
-#define _wcmdln (* __MINGW_IMP_SYMBOL(_wcmdln))
-/* __CRTIMP extern wchar_t *_wcmdln; */
-#endif
+_CRTIMP extern wchar_t ** __winitenv;
+_CRTIMP extern char ** __initenv;
+_CRTIMP extern char * _acmdln;
+_CRTIMP extern char * _wcmdln;
_CRTIMP __declspec(noreturn) void __cdecl _amsg_exit(int);
diff --git a/sdk/lib/crt/startup/charmax.c b/sdk/lib/crt/startup/charmax.c
index 42debd4fe4b..c910c53c5d7 100644
--- a/sdk/lib/crt/startup/charmax.c
+++ b/sdk/lib/crt/startup/charmax.c
@@ -7,7 +7,7 @@
#include <sect_attribs.h>
#include <internal.h>
-__declspec(dllimport) int __cdecl __lconv_init (void);
+_CRTIMP int __cdecl __lconv_init (void);
int mingw_initcharmax = 0;
diff --git a/sdk/lib/crt/startup/crtexe.c b/sdk/lib/crt/startup/crtexe.c
index ea9b13aaf22..3897242197b 100644
--- a/sdk/lib/crt/startup/crtexe.c
+++ b/sdk/lib/crt/startup/crtexe.c
@@ -4,11 +4,6 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
-#undef CRTDLL
-#ifndef _DLL
-#define _DLL
-#endif
-
#define SPECIAL_CRTEXE
#include <oscalls.h>
@@ -25,19 +20,9 @@
#endif
/* Special handling for ARM & ARM64, __winitenv & __initenv aren't present
there. */
-
#if !defined(__arm__) && !defined(__aarch64__)
-
-#ifndef __winitenv
-extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
-#define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv))
-#endif
-
-#ifndef __initenv
-extern char *** __MINGW_IMP_SYMBOL(__initenv);
-#define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
-#endif
-
+_CRTIMP extern wchar_t** __winitenv;
+_CRTIMP extern char** __initenv;
#endif
/* Hack, for bug in ld. Will be removed soon. */