wxWidgets: Byte Order

| Version: 3.2.2

Macros
Byte Order
Functions and Macros by Category

## Detailed Description

The endian-ness issues (that is the difference between big-endian and little-endian architectures) are important for the portable programs working with the external binary data (for example, data files or data coming from network) which is usually in some fixed, platform-independent format.

The macros are helpful for transforming the data to the correct format.

## Macros
#define | wxINT32_SWAP_ALWAYS(wxInt32_value)
| This macro will swap the bytes of the value variable from little endian to big endian or vice versa unconditionally, i.e. More...
#define | wxUINT32_SWAP_ALWAYS(wxUint32_value)
#define | wxINT16_SWAP_ALWAYS(wxInt16_value)
#define | wxUINT16_SWAP_ALWAYS(wxUint16_value)
#define | wxINT32_SWAP_ON_BE(wxInt32_value)
| This macro will swap the bytes of the value variable from little endian to big endian or vice versa if the program is compiled on a big-endian architecture (such as Sun work stations). More...
#define | wxUINT32_SWAP_ON_BE(wxUint32_value)
#define | wxINT16_SWAP_ON_BE(wxInt16_value)
#define | wxUINT16_SWAP_ON_BE(wxUint16_value)
#define | wxINT32_SWAP_ON_LE(wxInt32_value)
| This macro will swap the bytes of the value variable from little endian to big endian or vice versa if the program is compiled on a little-endian architecture (such as Intel PCs). More...
#define | wxUINT32_SWAP_ON_LE(wxUint32_value)
#define | wxINT16_SWAP_ON_LE(wxInt16_value)
#define | wxUINT16_SWAP_ON_LE(wxUint16_value)
#define | wxFORCE_LINK_THIS_MODULE(moduleName)
| This macro can be used in conjunction with the wxFORCE_LINK_MODULE() macro to force the linker to include in its output a specific object file. More...
#define | wxFORCE_LINK_MODULE(moduleName)
| This macro can be used in conjunction with the wxFORCE_LINK_THIS_MODULE() macro to force the linker to include in its output a specific object file. More...

## Macro Definition Documentation

## ◆ wxFORCE_LINK_MODULE

#define wxFORCE_LINK_MODULE | ( |  | moduleName | ) |

This macro can be used in conjunction with the wxFORCE_LINK_THIS_MODULE() macro to force the linker to include in its output a specific object file.

In particular, you should use this macro in a source file which you know for sure is linked in the output (e.g. the source file containing the `main()` of your app). The `moduleName` is the name of the module you want to forcefully link (i.e. the name you used in the relative wxFORCE_LINK_THIS_MODULE() macro.

Include file:

    #include <wx/link.h>

## ◆ wxFORCE_LINK_THIS_MODULE

#define wxFORCE_LINK_THIS_MODULE | ( |  | moduleName | ) |

This macro can be used in conjunction with the wxFORCE_LINK_MODULE() macro to force the linker to include in its output a specific object file.

In particular, you should use this macro in the source file which you want to force for inclusion. The `moduleName` needs to be a name not already in use in other wxFORCE_LINK_THIS_MODULE() macros, but is not required to be e.g. the same name of the source file (even if it's a good choice).

Include file:

    #include <wx/link.h>

## ◆ wxINT16_SWAP_ALWAYS

#define wxINT16_SWAP_ALWAYS | ( |  | wxInt16_value | ) |

## ◆ wxINT16_SWAP_ON_BE

#define wxINT16_SWAP_ON_BE | ( |  | wxInt16_value | ) |

## ◆ wxINT16_SWAP_ON_LE

#define wxINT16_SWAP_ON_LE | ( |  | wxInt16_value | ) |

## ◆ wxINT32_SWAP_ALWAYS

#define wxINT32_SWAP_ALWAYS | ( |  | wxInt32_value | ) |

This macro will swap the bytes of the value variable from little endian to big endian or vice versa unconditionally, i.e.

independently of the current platform.

Include file:

    #include <wx/defs.h>

## ◆ wxINT32_SWAP_ON_BE

#define wxINT32_SWAP_ON_BE | ( |  | wxInt32_value | ) |

This macro will swap the bytes of the value variable from little endian to big endian or vice versa if the program is compiled on a big-endian architecture (such as Sun work stations).

If the program has been compiled on a little-endian architecture, the value will be unchanged.

Use these macros to read data from and write data to a file that stores data in little-endian (for example Intel i386) format.

Include file:

    #include <wx/defs.h>

## ◆ wxINT32_SWAP_ON_LE

#define wxINT32_SWAP_ON_LE | ( |  | wxInt32_value | ) |

This macro will swap the bytes of the value variable from little endian to big endian or vice versa if the program is compiled on a little-endian architecture (such as Intel PCs).

If the program has been compiled on a big-endian architecture, the value will be unchanged.

Use these macros to read data from and write data to a file that stores data in big-endian format.

Include file:

    #include <wx/defs.h>

## ◆ wxUINT16_SWAP_ALWAYS

#define wxUINT16_SWAP_ALWAYS | ( |  | wxUint16_value | ) |

## ◆ wxUINT16_SWAP_ON_BE

#define wxUINT16_SWAP_ON_BE | ( |  | wxUint16_value | ) |

## ◆ wxUINT16_SWAP_ON_LE

#define wxUINT16_SWAP_ON_LE | ( |  | wxUint16_value | ) |

## ◆ wxUINT32_SWAP_ALWAYS

#define wxUINT32_SWAP_ALWAYS | ( |  | wxUint32_value | ) |

## ◆ wxUINT32_SWAP_ON_BE

#define wxUINT32_SWAP_ON_BE | ( |  | wxUint32_value | ) |

## ◆ wxUINT32_SWAP_ON_LE

#define wxUINT32_SWAP_ON_LE | ( |  | wxUint32_value | ) |