Defining Sections in Source Code

The compiler defines its own sections to organize the data and executable code it generates. You may also define your own sections directly in your program's source code.

Use the __declspec directive to specify where to place a single definition in object code. The following listing shows an example.

Listing: Using the __declspec directive to specify where to place definitions
#pragma define_section data_type ".myData" far_absolute RW
__declspec(data_type) int red;

__declspec(data_type) int sky;