Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ User's Guide - the "code_seg" pragma can be used to specify the name of the text segment http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The "code_seg" pragma can be used to specify the name of the text segment
into which the generated code for functions is to be placed.  The following
describes the form of the "code_seg" pragma.

+--------------------------------------------------------------------------+
|      #pragma code_seg ( seg_name [, class_name] ) [;]                    |
|                                                                          |
+--------------------------------------------------------------------------+

where
    description

seg_name
    is the name of the text segment enclosed in quotes.  Also, seg_name may
    be a macro as in:


         #define seg_name "MY_CODE_SEG"
         #pragma code_seg ( seg_name );

class_name
    is the optional class name of the text segment enclosed in quotes.
     Also, class_name may be a macro as in:


         #define class_name "MY_CLASS"
         #pragma code_seg ( "MY_CODE_SEG", class_name );


Consider the following example.


     #pragma code_seg ( "my_text" );

     int incr( int i )
     {
         return( i + 1 );
     }

     int decr( int i )
     {
         return( i - 1 );
     }

The code for the functions incr and decr will be placed in the segment
my_text.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson