sahlberg / libnfs

NFS client library
Other
524 stars 201 forks source link

Windows builds expect `writev` symbol #410

Closed FGasper closed 1 year ago

FGasper commented 1 year ago

As reported at https://github.com/FGasper/p5-Net-LibNFS/issues/11, builds against libnfs in Windows currently fail.

I can fix the issue by making this change:

diff --git a/include/win32/win32_compat.h b/include/win32/win32_compat.h
index 11ee4eb..578dc0f 100755
--- a/include/win32/win32_compat.h
+++ b/include/win32/win32_compat.h
@@ -162,7 +162,7 @@ struct iovec
   void *iov_base;
 };

-inline int writev(SOCKET sock, struct iovec *iov, int nvecs)
+static inline int writev(SOCKET sock, struct iovec *iov, int nvecs)
 {
   DWORD ret;

@@ -174,7 +174,7 @@ inline int writev(SOCKET sock, struct iovec *iov, int nvecs)
   return -1;
 }

-inline int readv(SOCKET sock, struct iovec *iov, int nvecs)
+static inline int readv(SOCKET sock, struct iovec *iov, int nvecs)
 {
   DWORD ret;
   DWORD flags = 0;

… which causes dumpbin /SYMBOLS libnfs.a | Findstr writev to go from:

002 00000000 SECT1  notype ()    Static       | writev
002 00000000 SECT1  notype ()    Static       | writev
01A 00000842 SECT1  notype ()    External     | zdr_writeverf3

… to:

038 00000000 UNDEF  notype ()    External     | writev
03D 00000000 UNDEF  notype ()    External     | writev
01A 00000842 SECT1  notype ()    External     | zdr_writeverf3

Is there any reason why this wouldn’t be an acceptable fix?

sahlberg commented 1 year ago

This has been merged