[zeromq-dev] how to receive a message into a static buffer?
Martin Sustrik
sustrik at fastmq.com
Wed May 6 09:31:28 CEST 2009
John, Pieter,
All the current language APIs return a byte array. If it's easy to use
bytearray from COBOL, it would be preferable to do it that way.
If using a byte array is particularly annoying with COBOL, copying the
data to static buffer can be used a substitute (trading functionality
for usability).
I am not a COBOL programmer so it's hard to judge. Is the limited
ability to receive arbitrarily large messages a reasonable tradeoff for
improved usability introduced by using static buffers instead of
dynamically allocated ones?
Martin
Pieter Hintjens wrote:
> On Tue, May 5, 2009 at 5:00 PM, Martin Sustrik <sustrik at fastmq.com> wrote:
>
>> No idea what errors are available in COBOL. Something like "buffer
>> overflow"?
>
> /me swaps state with 1986... COBOL is like C in that you pass errors
> using any convention you like. Usually you'll get a return value from
> a subroutine call.
>
>>> The length of a scalar variable in COBOL is 64KB. However, it is easy
>>> enough to create a structure, or array for that matter, of much
>>> greater length, so it is not a limitation.
>> An array of bytes may be a substitute for variable sized message, but it'll
>> make the usage of 0MQ pretty annoying in COBOL, right?
>
> John was just saying that while atomic variables may be limited in
> size, arrays thereof are not. This is about fooling the
> compiler/linker into setting aside appropriate amounts of storage.
>
> How about, for non-tiny messages, defining some kind of high level
> language 'descriptor' that languages can use, and which contains the
> real message to be accessed indirectly.
>
> -Pieter
More information about the zeromq-dev
mailing list