#pragma STRING_SEG: String Segment Definition

Scope

Until the next STRING_SEG pragma

Syntax

#pragma STRING_SEG (<Modif><Name>|DEFAULT)

Synonym

STRING_SECTION

Arguments
Listing: Some of the strings which may be used for <Modif>


 __FAR_SEG    (compatibility alias: FAR) __PAGED_SEG 
Note: Do not use a compatibility alias in new code. It only exists for backwards compatibility. Some of the compatibility alias names conflict with defines found in certain header files. So avoid using compatibility alias names.

The __SHORT_SEG modifier specifies a segment that accesses using 8-bit addresses. The definitions of these segment modifiers are backend-dependent.

<Name>: The name of the segment. This name must be used in the link parameter file on the left side of the assignment in the PLACEMENT part. For information, refer to the linker manual.

Default

DEFAULT.

Description

This pragma allocates strings into a segment. Strings are allocated in the linker segment STRINGS. This pragma allocates strings in special segments. String segments also may have modifiers. This instructs the Compiler to access them in a special way when necessary.

Segments defined with the pragma STRING_SEG are treated by the linker like constant segments defined with #pragma CONST_SEG, so they are allocated in ROM areas.

The pragma STRING_SEG sets the current string segment. This segment is used to place all newly occurring strings.

Note: The linker may support a overlapping allocation of strings. e.g., the allocation of CDE inside of the string ABCDE, so that both strings together need only six bytes. When putting strings into user-defined segments, the linker may no longer do this optimization. Only use a user-defined string segment when necessary.

The synonym STRING_SECTION has exactly the same meaning as STRING_SEG.

Example

The following listing is an example of the STRING_SEG pragma allocating strings into a segment with the name, STRING_MEMORY.

Listing: Using a STRING_SEG pragma to allocate a segment for strings


#pragma STRING_SEG __FAR_SEG STRING_MEMORY char * __far p="String1"; 
void f(char * __far ); 
void main(void) { 
 f("String2"); 
} 
#pragma STRING_SEG DEFAULT 
See also

RS08 Backend

Linker section of the Build Tools manual

#pragma CONST_SEG: Constant Data Segment Definition

#pragma DATA_SEG: Data Segment Definition