[nanomsg] Re: Problem with x64 build on windows

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Wed, 25 Sep 2013 16:06:25 +0200

Hi Immanuel,


so I did not actually read the error message of the device test in Jeffs
post, I thought I got the same one. Actually I did not. Mine is more
severe I think:
Assertion failed: opsz == sizeof (s1rcv)
(C:\Users\iweber\Documents\GitRepos\nan
omsg\src\core\device.c:111)
I investigated on that one and found the reason: the file descriptors in
a x64 build are 64 bit long instead of 32 bit in a x86 build.
The nn_device function in core/device.c defines the file descriptors to
be ints, which are in both cases 32 bit long. So we need to use a
plattform dependend type here.
In utils/efd_win.h there is a type nn_fd for the file descriptors, that
type directly depends on the SOCKET type in win.h and that is plattform
dependend. So nn_fd is maybe the right choice here?
The other efd_*.h define that one to be an int. But in efd.h there is a
define switch that selects the efd_win.h on windows. As I only have a
windows machine, I can not test if other plattforms are affected by that
too. But device.c is not aware of efd.h
In addition nn_device does some test for the file descriptors to be
negative, but the SOCKET type is allways to defined to be unsigned.

How to continue?

What about creating a new header file (src/utils/fd.h) that would define nn_fd in such a way that it resolves to SOCKET on windows and to int elsewhere? Then both efd and device can use that definition.

Martin


Other related posts: