bvarga / delphizmq

0MQ Delphi binding
GNU Lesser General Public License v3.0
137 stars 63 forks source link

Why delphizmq not support ZEROMQ4? #25

Open jfhyn opened 7 years ago

jfhyn commented 7 years ago

hi,Why delphizmq not support ZEROMQ4?

cpicanco commented 7 years ago

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.

bvarga commented 7 years ago

@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.

hgourvest commented 7 years ago

@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.

cpicanco commented 7 years ago

Thank you for the information Henry.

On Jul 12, 2017 19:47, "Henri Gourvest" notifications@github.com 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 .

prosd commented 7 years ago

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

cpicanco commented 7 years ago

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" notifications@github.com 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 .

prosd commented 7 years ago

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

cpicanco commented 7 years ago

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?

prosd commented 7 years ago

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.

tfrost commented 7 years ago

@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.

PizzaProgram commented 2 years ago

@prosd Yes, please share with us!

TT-Sam commented 1 year ago

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 commented 6 months ago

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.

josdemmers commented 6 months ago

@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).