[zeromq-dev] Problems with errno on Win32
Martin Sustrik
sustrik at 250bpm.com
Mon Feb 22 22:47:00 CET 2010
Hi Brian,
> I have tried some other things and am slowly uncovering more of the
> Windows errno problems:
>
> Python 2.5 links against msvcr71.dll, but libzmq.dll links against
> msvc90d.dll. These are the runtime libraries
> for VS 2003 and 2008 respectively. Some other folks I work with think
> that the problem may be related to
> having two different versions of the runtime loaded rather than treading.
Definitely. Each CRT has it's own errno. If different components in the
program use different CRTs they won't share the errno value. The result
will look exactly like what you are seeing: library asks the CRT to set
errno to 11, exits from function, returns to the caller component. The
caller checks errno from the CRT it is linked with (not the CRT the
library used!) and finds out it's value is zero :|
Btw, to avoid the problem above, also take care not to combine debug and
release versions of CRTs.
> Mingw uses the regular MS runtime libraries, but I think the version
> in this case is off (71 versus 90).
> BUT, the bug puzzle is that when I look at libzmq.dll in depends.exe,
> it says that msvcr90d.dll can't be found.
> Are you seeing that error? I have this on my system. Do I need to do
> something to tell libzmq.dll about its
> location?
Yes. I'm seeing it as well. It looks like the library is linked with
msvcr90.dll twice, once assuming it's in the current directory, second
time looking for it elsewhere.
It looks strange and it should be fixed, however, I don't believe it
causes the errno problem. Mixing multiple CRT versions seems much more
likely.
Martin
More information about the zeromq-dev
mailing list