16
Programming / Aligning on 64k boundary
« on: September 14, 2020, 05:34:10 pm »
The Control Program reference says in the Remarks for DosWrite()
"When writing message pipes the application is limited to 64K messages. As well, these messages cannot span 64k boundaries due to the current design of the thunk layer in read or write routines. If the message is not written in an aligned manner, the subsequent read will not be able to handle the messages properly."
Since this is talking about thunking I assume it is for the 32 bit version of OS/2 rather than a relic from the 286 version of OS/2. And besides you need to be able to read/write to a pipe from WinOS2.
How do you allocate memory (a buffer for a message) so that it does not cross a 64k boundary?
I am programming in C - specifically VisualAge.
I don't see anything specific in DosAllocMem(). The #pragma pack only addresses alignment to 1,2,4,8 or 16 byte alignments.
"When writing message pipes the application is limited to 64K messages. As well, these messages cannot span 64k boundaries due to the current design of the thunk layer in read or write routines. If the message is not written in an aligned manner, the subsequent read will not be able to handle the messages properly."
Since this is talking about thunking I assume it is for the 32 bit version of OS/2 rather than a relic from the 286 version of OS/2. And besides you need to be able to read/write to a pipe from WinOS2.
How do you allocate memory (a buffer for a message) so that it does not cross a 64k boundary?
I am programming in C - specifically VisualAge.
I don't see anything specific in DosAllocMem(). The #pragma pack only addresses alignment to 1,2,4,8 or 16 byte alignments.