[zeromq-dev] 0MQ and Windows X65 --- compiled and running using VS2010

Jarred Ward jarred at webriots.com
Wed Apr 14 21:47:47 CEST 2010


Did the same code change the other day, and can also confirm that it works.

If I recall, all the compiler warnings were because of the 8-byte size_t on
x64. I didn't dive any deeper than just reading the warnings.

Here is the fix to get the CLR bindings to run against either x86 and x64. I
don't have a github account yet...

zmq.cs
182,184c182,183
<         //  TODO: Size of zmq_msg_t may differ depending on platform.
<         //  For example, on Win64 it'll definitely be longer.
<         private const int ZMQ_MSG_T_SIZE = 36;
---
>         // Determine if we're 64 or 32 bit and set msg size accordingly
>         private readonly int ZMQ_MSG_T_SIZE = IntPtr.Size == 4 ? 36 : 40;

Have tested that the binding works as expected in a Windows environment with
a x64 ZMQ build.

On Wed, Apr 14, 2010 at 11:41 AM, Apps, John <john.apps at hp.com> wrote:

> Not too long ago, someone asked about compiling 0MQ on Windows X64. With
> the help of my colleague, Brett Cameron, I have a working version compiled
> using VS2010 and running on Windows 7 X64.
> Only one minor change was required in atomic_ptr.hpp:
>
> #if defined ZMQ_ATOMIC_PTR_WINDOWS
> //            return (T*) InterlockedExchangePointer (&ptr, val_);
>            return (T*) InterlockedExchangePointer ((PVOID *) &ptr, val_);
>
> The change is a quick solution and is not, in my mind, what really should
> be done. There are a  number of preprocessor statements which equate X86
> with X64, thus leading to the use of 32-bit pointers and data types. These
> should be changed to differentiate between the two machine types.
>
>
> Does it work? Yes. Is it faster? Do not know yet, hope to do some testing
> in the near future as time permits.
> ----------------------------------------------------
> Dumps of the respective programs, LOCAL_LAT in this case, show the X86 and
> X64 images. See below.
>
> Dump of file \\bigwinnie\bigwinniec$\amqp\zeromq-2.0.6\bin\local_lat.exe
>
> PE signature found
>
> File Type: EXECUTABLE IMAGE
>
> FILE HEADER VALUES
>             14C machine (x86)
>               7 number of sections
>        4BAB295D time date stamp Thu Mar 25 10:14:05 2010
>               0 file pointer to symbol table
>               0 number of symbols
>              E0 size of optional header
>             102 characteristics
>                   Executable
>                   32 bit word machine
> ----------------------------------------------------
> Dump of file C:\amqp\zeromq-2.0.6\bin\local_lat.exe
>
> PE signature found
>
> File Type: EXECUTABLE IMAGE
>
> FILE HEADER VALUES
>            8664 machine (x64)
>               7 number of sections
>        4BC5D8E8 time date stamp Wed Apr 14 17:02:00 2010
>               0 file pointer to symbol table
>               0 number of symbols
>              F0 size of optional header
>              22 characteristics
>                   Executable
>                   Application can handle large (>2GB) addresses
> ----------------------------------------------------
> -- John.Apps at hp.com | +491718691813 | http://twitter.com/johnapps --
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100414/5d2f36f4/attachment.html>


More information about the zeromq-dev mailing list