mingw-w64 / mingw-w64.github.io

mingw-w64.net web page contents (The new web page)
Other
576 stars 1.18k forks source link

wcstok() defined differently in string.h and wchar.h for UCRT #7

Closed brechtsanders closed 1 year ago

brechtsanders commented 2 years ago

When using a UCRT build of MinGW-w64 9.0.0 (see my personal builds at https://winlibs.com/) wcstok() seems to be defined differently in string.h and wchar.h.

string.h defines wcstok() with 2 arguments:

  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * __restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;

wchar.h defines wcstok() with 3 arguments if _UCRT is defined:

#if defined(_UCRT)
  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * __restrict__ _Delim,wchar_t **_Ptr) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
#else
  wchar_t *__cdecl wcstok(wchar_t * __restrict__ _Str,const wchar_t * __restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
#endif

This is giving me a lot of trouble with the ACE library when building YARP with UCRT.

Biswa96 commented 2 years ago

Same confusion here also https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l

Biswa96 commented 1 year ago

This issue was probably fixes in https://github.com/mingw-w64/mingw-w64/commit/40134887fb81f5be451b5c4c92dc1e0372f08b68 commit.