gpgme fails to compile with mingw due to wrong macro

Werner Koch wk at gnupg.org
Mon May 22 10:34:47 CEST 2023


Hi!

> python3.10-gpg/helpers.h:30:28: error: expected expression before '{' token
>    30 | #define write(fd, str, sz) {DWORD written; WriteFile((HANDLE)
> fd, str, sz, &written, 0);}

I don't believe what I see in gpgme:

#ifdef _WIN32
#include <windows.h>
#define write(fd, str, sz) {DWORD written; \
                            WriteFile((HANDLE) fd, str, sz, &written, 0);}
#endif

This looks more like an experimental test code.  The function does not
return anything (which is the cause of the above error) and WriteFile
and write have different properties.  Thus the suggested fix is not also
not right.  Someone(tm) needs to look at the use cases of write.

> 1. Disable the write() macro with `#ifdef _MSC_VER` (true for msvc
> only). I am not sure if Microsoft Windows' write function is
> equivalent with *nix's one.

Yes, it is but if you may need to use _write instead of write unless you
include the oldnames.h or so header.


Shalom-Salam,

   Werner

-- 
The pioneers of a warless world are the youth that
refuse military service.             - A. Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20230522/f089f69c/attachment-0001.sig>


More information about the Gnupg-devel mailing list