[zeromq-dev] Problem with embedded ZeroMQ (static lib) under Windows

Oliver Smith oliver at kfs.org
Fri Apr 29 19:14:54 CEST 2011


On 4/29/2011 2:20 AM, Pieter Hintjens wrote:
>> I've just updated our project's ZeroMQ to 2.1.6 from 2.1.0.
>>
>> We build zeromq as a static library and then embed it into the application.
>> (The only real trick to making this work was that the ZeroMQ headers
>> automatically go about using DLL_EXPORT if _WIN32 is defined).
>>
>> After the upgrade, we're running into a problem where zmq:connect() causes a
>> crash, which appears to be a Multi-Byte Character / Unicode conflict -- we
>> build our project (and our ZeroMQ) with Unicode.
> Did you make any changes to 2.1.0? The 2.1.6 package should be a drop
> in replacement, except for fixing a lot of bugs.
The only change was forcing the definition of DLL_EXPORT and DLL_IMPORTs 
to facilitate a static library.

The crash is basically caused by the forced casting to char* of the 
incoming string, which is actually being stored as wchar_ts. Thus 
instead of the UUID being <byte><byte><byte><byte> ... it is 
<byte><0><byte><0><byte><0>...

- Oliver




More information about the zeromq-dev mailing list