在 2026-8-16 23:10, Zhongteng Gui 写道:
Take strchr as an example, other things are similar

#ifdef __cplusplus
extern "C++" {
   const char *__cdecl strchr(const char *, int)
     __MINGW_ASM_CALL(strchr);

   inline char *__cdecl strchr(char *str, int ch)
   { return const_cast<char *>(strchr(const_cast<const char *>(str), ch)); }
}
#else
char *__cdecl strchr(const char *, int);
#endif

The difference between glibc is that we only define one C++ version with 
__asm__ instead of both.
This is used to avoid -Wodr under LTO, see https://godbolt.org/z/nc1ejss3r

I think this is doable. However you should use reserved identifiers for parameters in standard headers; for this function those parameters should be `_Str` and `_Ch`.



--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to