C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
init_seg (C++)
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
  Pragma:   init_seg
 
  Syntax:   #pragma init_seg({ compiler | lib | user | "seg-name" })
 
  Summary:  Specifies a keyword or segment that affects the order
            in which startup code is executed.
 
     The init_seg pragma specifies a keyword or segment that affects
     the order in which startup code is executed. Because
     initialization of global static objects can involve executing
     code, you must specify a keyword that defines when the objects
     are to be constructed. It is particularly important to use the
     init_seg pragma in DLLs or libraries requiring initialization.
 
     The options to the init_seg pragma are:
 
     Option       Meaning
 
     compiler     Reserved for Microsoft C run-time library
                  initialization. Objects in this group are
                  constructed first.
 
     lib          Available for third-party class-library vendors'
                  initializations. Objects in this group are
                  constructed after those marked as compiler but
                  before any others.
 
     user         Available to any user. Objects in this group are
                  constructed last.
 
     seg-name     Allows explicit specification of the initialization
                  segment. Objects in a user-specified <seg_name> are
                  not implicitly constructed; however, their addresses
                  are placed in the segment named by <seg-name>.
 
     If you need to defer initialization (for example, in a DLL), you
     may choose to specify the segment name explicitly. You must then
     call the constructors for each static object. For an example of
     how these initializations are done, see the file CRT0DAT.ASM in
     the STARTUP\DOS directory.
                                    -♦-