#pragma alloc_text (OS/2, Windows)

Description

The #pragma alloc_text directive groups functions into separate 32-bit code segment. By default, functions that are not grouped into a section by #pragma alloc_text are placed into the default 32-bit code segment, CODE32.

Syntax

The code_section is the name of the segement of code where you want to place the function function. You can specify any number of functions to be included in the named code_section.

Defining your own code segments allows you to organize functions in memory so that the working set requires fewer pages of memory. You can also specify attributes for each section, such as execute-only or preload. Code section attributes are specified with the link(section, name, attributes) and link(code, attributes) options.

For example, the following creates two code segments, one load_on_call, and the other preload_seg:

#pragma alloc_text(preload_seg, func1)
#pragma alloc_text(load_on_call, func2)



Preprocessor Directives - An Overview
Preprocessor Directive - #pragma


section Link Options - link(section, name, attributes)
code Link Options - link(code, attributes)