delphizmq icon indicating copy to clipboard operation
delphizmq copied to clipboard

Why delphizmq not support ZEROMQ4?

Open jfhyn opened this issue 7 years ago • 14 comments

hi,Why delphizmq not support ZEROMQ4?

jfhyn avatar Jun 09 '17 03:06 jfhyn

This would be great. The recommendation of the libzmq devs is to automate zmq bindings through https://github.com/zeromq/zproject

I am not sure how the delphizmq zmqapi would behave though.

cpicanco avatar Jun 09 '17 12:06 cpicanco

@jfhyn : I don't work with zeromq lately, so there were no motivation for me to keep it up to date, I just started working on, what you can find is under the develop branch of this repo. However I would love to accept any pull requests.

@cpicanco : I would not go that direction (I admit I have not much knowledge about zproject), but I think it would be a much bigger project than just updating zmq.pas regularly.

bvarga avatar Jun 09 '17 13:06 bvarga

@cpicanco libzmq is not compatible with ZProject but CZMQ and Zyre are compatibles. You should take a look on my fork here: https://github.com/hgourvest/zproject. It can generate Delphi API for both of them.

hgourvest avatar Jul 12 '17 22:07 hgourvest

Thank you for the information Henry.

On Jul 12, 2017 19:47, "Henri Gourvest" [email protected] wrote:

@cpicanco https://github.com/cpicanco libzmq is not compatible with ZProject but CZMQ and Zyre are compatibles. You should take a look on my fork here: https://github.com/hgourvest/zproject. It can generate Delphi API for both of them.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bvarga/delphizmq/issues/25#issuecomment-314919319, or mute the thread https://github.com/notifications/unsubscribe-auth/AGNc6eWCkNUad1bbbYhWLC8kWZLfnsUxks5sNU0CgaJpZM4N03hW .

cpicanco avatar Jul 13 '17 03:07 cpicanco

Hi, I'm looking for ZMQ V4 wrapper for Delphi XE7 (64 bits) or higher. Hope someone can help. Thank you in advance!

prosd avatar Aug 02 '17 16:08 prosd

There is no delphi zmq 4 api afaik, it goes up to 3.2.5 in this repo. There is a fpc binding for 4.2.2 called zeromq-fpc with no api in the official site and I am working on binding it to master right now just for fun.

On Aug 2, 2017 13:03, "prosd" [email protected] wrote:

Hi, I'm looking for ZMQ V4 wrapper for Delphi XE7 (64 bits) or higher. Hope someone can help. Thank you in advance!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bvarga/delphizmq/issues/25#issuecomment-319718414, or mute the thread https://github.com/notifications/unsubscribe-auth/AGNc6T-G7UBW9pu14PsBof341Kaa8Abfks5sUJ3QgaJpZM4N03hW .

cpicanco avatar Aug 02 '17 16:08 cpicanco

Thanks for the feedback. Meanwhile I installed V3.2.4 (32 Bit). Are there any plans to support the 64-bit version of ZMQ?

prosd avatar Aug 04 '17 12:08 prosd

I am afraid currently there is no motivation for @bvarga to support 64bits. I have the motivation, but currently don't have enough expertise. Who knows in the future?

cpicanco avatar Aug 04 '17 12:08 cpicanco

Allright, again thank you for the prompt reply. I downloaded the 4.2.2 FPC version and altered it to be compatible with Delphi (which was a relatively easy job, I must say). All looks good, except for the "zmq_bind" function: whatever I try to bind, it always returns error #22 (which is undocumented). Any ideas?

UPDATE: You can ignore my last question. I was using the PChar type which defaulted to PWideChar in XE7.

prosd avatar Aug 05 '17 09:08 prosd

@prosd - I would appreciate seeing the compatible-with-Delphi results of your 'relatively easy job' if you felt like sharing them! Or at least a summary of what you needed to change.

tfrost avatar Oct 26 '17 10:10 tfrost

@prosd Yes, please share with us!

PizzaProgram avatar Aug 07 '22 01:08 PizzaProgram

In case this helps anyone, I was able to produce a modern (4.3.4) build of ZeroMQ, and to reuse the bindings here with one change:

in zmq.pas, I had to change zmq_msg_t = record_: Array[0..32-1] of Byte; to zmq_msg_t = record_: Array[0..64-1] of Byte;

(See #https://github.com/zeromq/libzmq/pull/1298)

Of course, you'll have to add any new features to the base classes still, but if all you want is a working Delphi build around the current dll, that should do it for you.

TT-Sam avatar Aug 07 '23 18:08 TT-Sam

In case this helps anyone (again), I was able to produce a modern (4.3.4) build of ZeroMQ in 64bit, and to reuse the bindings here in a 64bit Delphi 10 project with -The change in my previous comment -in zmq.pas, I had to change size_t = Cardinal; to size_t = NativeUINT;

That specifically resolved some issues with getSockOpt and getSockOptInt64. I can't promise that fixes everything, but we had a reasonably extensive test suite that this passes for.

I admit that I don't understand the exact nuances of that change, but I was advised "C++'s size_t and Delphi's Cardinal are not guaranteed to be the same size. size_t may be 32bit or 64bit depending on compiler, but Cardinal is always 32bit. Try using `NativeUint instead on the Delphi side." by the StackOverflow community.

TT-Sam avatar May 17 '24 19:05 TT-Sam

@TT-Sam Great! Looks like the change to NativeUINT finally solved my problem that multipart messages always stopped after receiving the first frame (when using 64bit).

josdemmers avatar May 24 '24 13:05 josdemmers