Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation isn't clear on the matter but it seems that the struct module has 'i' as a fixed 4 bytes and 'l' is 4 on 32bit and 8 on 64bit. Not tested on 32 bit build.
- Loading branch information
aed1521
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this commit is breaking things on 64-bit Linux. On Windows,
'l'
and'i'
have the same size regardless of whether it's 64-bit vs 32-bit. On Linux (and MacOS) the size between the two changes.I read the issue this was in response to (#64), but since there wasn't a test case on that issue I couldn't reproduce it. My understanding is that
'i'
is the correct format code to use, because all the options in the C library really are ints -- e.g. https://github.com/nanomsg/nanomsg/blob/master/src/core/sock.c#L421 shows theswitch
statement that returns the right option based on the flag passed in. Based on that code, the right type to use is 'i', not 'l', at least for all those options.aed1521
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To give more information, I'm using the extension module wrapper (not ctypes), and here is some test code that fails:
The error message is
aed1521
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, they are all int32, apart from NN_SNDFD and NN_RCVFD which on windows are a SOCKET and 8 bits so probably just need to special case those?
aed1521
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me!