### Define Code and Data Segments in a DLL

You can specify different attributes for different sets of data or code in two ways:

- Use the #pragma data_seg and #pragma alloc_text directives to define your own data and code segments
- Use the /Nd and /Nt compiler options to specify the name of the default data or code segments, respectively.

You can then list the segments in the module definition file under the heading SEGMENTS, and specify attributes for each. For example:

       SEGMENTS

          mydata SHARED READONLY

          mycode PRELOAD

Any segments that you do not specify under SEGMENTS are given the attributes specified by the DATA or CODE statement, depending on the type of segment.

Example of a Module Definition File