The new platform brougth up several issues:
- Byte ordering
- GCC compilation
- Coding & other issues
1. Byte ordering
The MacTel platform (as other Intel platforms) is little endian, whereas the PPC platform is big endian. This affects the following areas of add-ons:
Resources | stored as big endian. This has the advantage of having the same resource files on MacTel. (and, by the way, Apple also decided to go this way) |
Platform sign | a new platform sign (‘mm ‘) indicates information written on the MacTel platform. |
Byte swapping | the GSRoot module has a group of functions which support byte swapping between the different platforms. See the functions in the IV.hpp header.All IVxxx functions are now have the input platform as the first parameter; the output is always swapped to the current platform. |
Preferences, files | as a consequence, all information which is written into the preferences or files has to be checked for platform support. Storing the home platform was a recommended practice in the past… You can find an example of the correct usage in the Do_FillSettings () function in the DG_Test example.The C++ solution for this is to use channels and the InputOutput module; see the IO::SetPlatformIProtocol function for details. Please note that the class to be serialized should conform to certain requirements (e.g. should inherit from GS::Object ). |
2. GCC Compilation
Switching to the GCC compiler brought up certain issues:
Warnings | the GCC compiler is stricter in many cases. You’ll get many warnings during compilation; you can turn most of them off in the Xcode build settings; though as a general rule they usually worth to take a look. |
10.4u (universal) SDK | the first system version on MacTel is 10.4, hence the first SDK is also the 10.4 SDK. If you relied on certain system functionality which has changed from 10.3, then you’ll have to adjust the code to work with 10.4. |
dll_export, dll_import | see this and this documents. The PlatformDLLExport.hpp header defines the following two directives:PLATFORM_DLL_EXPORT and PLATFORM_DLL_IMPORT If you write platform-independent code, these can make your life easier. |
3. Coding & other issues
This section lists issues we came across during the MacTel transition.
printf arguments |
if you use “%ld” to print double numbers, the ‘l‘ has to be small. The capital ‘L‘ means long double for the GCC compiler, and you’ll get garbage on the output if you pass a normal double number. The '-Wformat' warning will warn you about this. |