diff --git a/src/core/sys/posix/inttypes.d b/src/core/sys/posix/inttypes.d index e2954eda5c..033eb74194 100644 --- a/src/core/sys/posix/inttypes.d +++ b/src/core/sys/posix/inttypes.d @@ -38,3 +38,21 @@ intmax_t strtoimax(in char*, char**, int); uintmax_t strtoumax(in char *, char**, int); intmax_t wcstoimax(in wchar_t*, wchar_t**, int); uintmax_t wcstoumax(in wchar_t*, wchar_t**, int); + +version (Cpp98) +{ +} +else +{ + /* Add backwards compatibility overloads to the same functions for wchar* and dchar*. + * Being C with no name mangling, they'll resolve to the same functions. + */ + version (Windows) + private alias _old_wchar_t = wchar; + else version (Posix) + private alias _old_wchar_t = dchar; + + intmax_t wcstoimax(in _old_wchar_t* nptr, _old_wchar_t** endptr, int base); + uintmax_t wcstoumax(in _old_wchar_t* nptr, _old_wchar_t** endptr, int base); +} + diff --git a/src/core/sys/posix/stdlib.d b/src/core/sys/posix/stdlib.d index dcd302739c..a56e618e81 100644 --- a/src/core/sys/posix/stdlib.d +++ b/src/core/sys/posix/stdlib.d @@ -678,3 +678,22 @@ else version (CRuntime_UClibc) int mkstemp(char*); } } + +version (Cpp98) +{ +} +else +{ + /* Add backwards compatibility overloads to the same functions for wchar* and dchar*. + * Being C with no name mangling, they'll resolve to the same functions. + */ + version (Windows) + private alias _old_wchar_t = wchar; + else version (Posix) + private alias _old_wchar_t = dchar; + + int mbtowc(scope _old_wchar_t* pwc, scope const char* s, size_t n); + size_t mbstowcs(scope _old_wchar_t* pwcs, scope const char* s, size_t n); + size_t wcstombs(scope char* s, scope const _old_wchar_t* pwcs, size_t n); +} +