Page MenuHome GnuPG

libgpg-error on Windows: strerror_s can be used instead of strerror_r
Closed, ResolvedPublic

Description

hello

I am trying to build libgpg-error 1.36 on Windows, using MSYS2 + mingw-w64. Looking at configure output, it is mentioned that strerror_r is not available. So I would like to mention that strerror_s exists and is the Windows function equivalent to strerror_r on Unix (not the GNU variant). See

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strerror-s-strerror-s-wcserror-s-wcserror-s?view=vs-2019

the only thing which is different is the order of the arguments

Would it be possible to add support of strerror_s on Windows ?

I think that some code like :

#ifdef _WIN32
#define strerror_r(errnum, buf, buflen) strerror_s(buf, buflen, errnum)
#endif

should be sufficient

thank you

Details

Version
1.36

Revisions and Commits

Event Timeline

werner triaged this task as Normal priority.May 24 2019, 3:19 PM
werner added a project: gpgrt.
werner added a subscriber: werner.

I guess we can do that. Thanks for the hint.

gniibe added a subscriber: gniibe.

I think that detecting strerror_s by configure is better, because it's a new feature on Windows.

gniibe changed the task status from Open to Testing.May 29 2019, 4:19 AM

Fix pushed.