Previous: Include Files Up: Porting C Next: Machine Dependencies

VMS-Specific Code

Many current VICAR applications and subroutines have VMS-specific code embedded in them. Some of it is obvious, like a system service call. Some is insidiously difficult to find, like using a double floating point value as a single. This works because on the VAX the first half of a double value looks like a float. This is not the case on any other machine.

All the VMS-specific code must, of course, be eliminated or isolated. If the same thing can be done in a portable way, do it that way. If not, then isolate the VMS-specific code and write Unix code to perform the same function. If the function is useful as a general-purpose subroutine, then put it in SUBLIB. If not, include it with your code. See the next section, Section , Machine Dependencies, for methods of dealing with machine-dependent code.

An attempt is made below to list the types of VMS-specific code you will run into. This is not and can not be an exhaustive list, as there are far too many potential problem areas that will only be uncovered with more experience. Use this list as examples of what to look out for. You should be familiar with writing portable C code; if not then see a standard C manual. If in doubt, try it, or ask.

rgd059@ipl.jpl.nasa.gov