Specifying Code Segments

The alloc_text pragma lets you name the segment in which particular functions are allocated. It has the following syntax:

#pragma alloc_text (textsegment, function1[[, function2]]...)

If you use overlays or swapping techniques to handle large programs, alloc_text allows you to tune the contents of their code (text) segments for maximum efficiency. The alloc_text pragma must appear before the definitions of any of the specified functions and after the declarations of these functions. Functions referenced in an alloc_text pragma should be defined in the same module as the pragma. If this is not done and an undefined function is later compiled into a different code segment, the error may not be caught.

Another way to specify the segment in which a function resides is to use based addressing for functions. You can also use based addressing to specify the segment in which a data item resides.