[<<<] [>>>]

This function saves the binary code of the program into the file given by the name szFileName.

This version is hard wired saving the code into an operating system file because it uses fopen, fclose and fwrite. Later versions may use other compatible functions passed as argument and thus allowing output redirection to other storage media (a database for example).

However I think that this code is quite simple and therefore it is easier to rewrite the whole function along with @xref{build_LoadCode()} for other storage media than writing an interface function.

The saved binary code is NOT portable. It saves the internal values as memory image to the disk. It means that the size of the code depends on the actual size of long, char, int and other types. The byte ordering is also system dependant.

The saved binary code can only be loaded with the same version, and build of the program, therefore it is vital to distinguish each compilation of the program. To help the recognition of the different versions, the code starts with a version structure.

The very first byte of the code contains the size of the long on the target machine. If this is not correct then the code was created on a different processor and the code is incompatible.

The version info structure has the following fileds:

int build_SaveCode(pBuildObject pBuild,
                   char *szFileName
The function returns zero on success (BU_ERROR_SUCCESS) and BU_ERROR_FAIL if the code could not be saved.
[<<<] [>>>]