https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fdd1d7d60c33b08f4181df...
commit fdd1d7d60c33b08f4181df8e81c739694762898b Author: Victor Perevertkin victor@perevertkin.ru AuthorDate: Sun Oct 20 13:44:17 2019 +0300 Commit: Colin Finck colin@reactos.org CommitDate: Sun Oct 20 12:44:17 2019 +0200
[MSVCRT] Export __acrt_iob_func to fix GCC build with latest RosBE 2.2 (#1835)
This adds an evil hack to persuade libstdc++, which tries to import __acrt_iob_func from a DLL. This can only be solved cleanly by adding a GCC-compatible C++ standard library to our tree later. --- sdk/lib/crt/msvcrtex.cmake | 3 ++- sdk/lib/crt/stdio/acrt_iob_func.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/sdk/lib/crt/msvcrtex.cmake b/sdk/lib/crt/msvcrtex.cmake index c46751007ad..5be20560a53 100644 --- a/sdk/lib/crt/msvcrtex.cmake +++ b/sdk/lib/crt/msvcrtex.cmake @@ -39,7 +39,8 @@ list(APPEND MSVCRTEX_SOURCE misc/fltused.c misc/isblank.c misc/iswblank.c - misc/ofmt_stub.c) + misc/ofmt_stub.c + stdio/acrt_iob_func.c)
if(MSVC) list(APPEND MSVCRTEX_SOURCE diff --git a/sdk/lib/crt/stdio/acrt_iob_func.c b/sdk/lib/crt/stdio/acrt_iob_func.c new file mode 100644 index 00000000000..223ea36b5fa --- /dev/null +++ b/sdk/lib/crt/stdio/acrt_iob_func.c @@ -0,0 +1,24 @@ +/* + * PROJECT: ReactOS CRT library + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: __acrt_iob_func implementation + * COPYRIGHT: Victor Perevertkin victor.perevertkin@reactos.org + */ + +// Evil hack necessary, because we're linking to the RosBE-provided libstdc++ when using GCC. +// This can only be solved cleanly by adding a GCC-compatible C++ standard library to our tree. +#ifdef __GNUC__ + +#include <precomp.h> + +/********************************************************************* + * __acrt_iob_func(MSVCRT.@) + */ +FILE * CDECL __acrt_iob_func(int index) +{ + return &__iob_func()[index]; +} + +const void* _imp____acrt_iob_func = __acrt_iob_func; + +#endif