net: fix windows constants to make them public for net.unix usage #20183
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following this post: forum_discuss
It was not possible to use or compile code containing calls to the "net.unix" library on a Windows environment ( in my case, Windows 10). The errors encountered were:
v/vlib/net/unix/stream.c.v:73:54: error: constant 'net.msg_nosignal' is private
C.photon_send(c.sock.handle, ptr, remaining, net.msg_nosignal, c.write_timeout)
v/vlib/net/unix/stream.c.v:75:47: error: constant 'net.msg_nosignal' is private
C.send(c.sock.handle, ptr, remaining, net.msg_nosignal)
v/vlib/net/unix/stream.c.v:380:47: error: constant 'net.fionbio' is private
net.socket_error(C.ioctlsocket(handle, net.fionbio, &t))!
v/vlib/net/unix/stream.c.v:493:47: error: constant 'net.fionbio' is private
net.socket_error(C.ioctlsocket(sockfd, net.fionbio, &t))!
Test code to replicate the error:
To address these issues, the affected constants have been made public in net_windows.c.v file.
I did not add a test file as merely importing 'net.unix' in the code was sufficient to trigger the previously mentioned errors. However, if required, I am ready to provide it.