background image
Tech Note #10: Portable Object Code
Ó1997 Bionic Buffalo Corporation; All Rights Reserved.
           19 October 1997
http://www.tatanka.com
Page 
ê
 
free ( _gmx_305598 ) ;
 
if ( _gmx_302049 == NULL ) return 1 ;
 
if ( ! strcmp ( _gmx_302049, "" ) ) return 1 ;
 
return 0 ;
 
_gmx_282251:
 
if ( strcmp ( _gmx_302049, _gmx_305598 ) ) goto _gmx_197896;
 
goto _gmx_391337;
 
_gmx_197896:
 
free ( _gmx_305598 ) ;
 
return 0 ;
 
_gmx_391337:
 
free ( _gmx_305598 ) ;
 
return 1 ;
 
}
This code is difficult to understand. However, there are several important points to be noticed:
· The code is valid standard C, and is acceptable to any standard C compiler.
· Well-known external names (such as the name of the routine itself) are not modified.
· Some library routines (such as 
 
strcmp()
) which might cause in-line code generation by some
compilers are not changed.
The last two points means that standard public routines may be replaced. For example, this
routine might be replaced with a user-supplied version which performs differently, or a user-
supplied preamble might be placed in front of the obscure source.
Other Forms
Although the example above is typical, there are other forms of portable object code to be found
in Bionic Buffalo products. The form depends on which tool was used to create the program:
some forms are more readable than this example, and some are less readable. In some cases, the
line boundaries do not correspond to natural source-language statement boundaries, and in
others there is extensive use of macros.
The main point is: portable object code is not intended to be intelligible to humans.
Elements of Portability
In spite of its appearance, portable object code is highly portable. We use 
 
lint
 and other tools
extensively to verify our sources, whether or not generated by automated tools. Most important,
we maintain a common code base across a wide variety of platforms.