| 1 |
Architecture support |
| 2 |
==================== |
| 3 |
|
| 4 |
bin-prot works at its best on little endian architecture and has been |
| 5 |
thoroughly tested only on i386 and amd64. Using it on other architectures can |
| 6 |
exhibit a number of limitation. Here is a summary of such limitation taken from |
| 7 |
a post by upstream author Markus Mottl to the Caml mailing list |
| 8 |
(http://groups.google.com/group/fa.caml/msg/80da07bb322f2d7a) |
| 9 |
|
| 10 |
> We currently do not have any immediate need and man power to fully |
| 11 |
> support big-endian machines (we also don't have access to any), but |
| 12 |
> we'll gladly accept patches. This could be implemented using |
| 13 |
> platform-specific macros as is the case with 32/64bit. |
| 14 |
> |
| 15 |
> This is what works / doesn't work as of now: |
| 16 |
> |
| 17 |
> *) Big-endian and little-endian machines cannot communicate with |
| 18 |
> each other for anything but very specific cases. Don't use the binary |
| 19 |
> protocol in such heterogeneous environments. |
| 20 |
> |
| 21 |
> *) 32 and 64 bit, little-endian architectures can communicate |
| 22 |
> freely, assuming, of course, that integers do not overflow on 32bit. |
| 23 |
> This is tested at runtime to prevent hard to debug errors. |
| 24 |
> |
| 25 |
> *) 32bit big-endian machines can communicate with each other freely. |
| 26 |
> 64 bit big-endians can communicate with each other freely, too, but |
| 27 |
> not necessarily with 32bit big-endians: values of type int64, etc., |
| 28 |
> may not necessarily be communicated correctly. Note, too, that you |
| 29 |
> should exclusively use the automatically generated converters on |
| 30 |
> big-endian machines. The hand-written (slower) ones for the basic |
| 31 |
> types are intended mostly for testing purposes only, and will not work |
| 32 |
> when mixed with a different endianness (they assume little-endians). |
| 33 |
> |
| 34 |
> Thus, it certainly makes sense to package the binary protocol for |
| 35 |
> big-endians, too, as long as people are informed of what works. Since |
| 36 |
> almost nobody uses big-endian machines, most users won't care. But |
| 37 |
> I'd surely be happy to see a patch to fully support all |
| 38 |
> architectures... |
| 39 |
|
| 40 |
-- Stéphane Glondu <[email protected]>, Wed, 17 Aug 2016 13:52:48 +0200 |