The information in this article applies to:
SUMMARY
Using dynamic-link libraries (DLLs) is a very flexible way to
centralize a body of program code. Many applications may use functions
from a DLL, while only one copy of the DLL code is in memory. This
contrasts with code that is statically linked into applications, which
requires each application to have its own copy of the shared code.
MORE INFORMATION
The most common reason to use a DLL that does not have its own data
segment is to ensure that the data segment (DS) register and stack
segment (SS) register are the same (DS == SS). A large majority of the
functions provided with the C run-time libraries expect that DS == SS.
Functions with this requirement have been removed from the
DLL-specific libraries included with the Windows Software Development
Kit (SDK).
This warning is generated when a data segment has been created by the C Compiler; however, flags have not been defined for that segment (such as MULTIPLE or DISCARDABLE). The default setting for these segments is PRELOAD SINGLE. A DLL that uses the C run-time code references a global internal variable __acrtused, which is declared as follows in LIBENTRY.ASM:
Referencing this variable informs the linker that the DLL will use the
C run-time code. If the C run-time code is not required by the DLL,
this line should be removed to allow a truly DATA NONE DLL to be
created.
If the C run-time code is actually used by the DLL, __acrtused must be declared. This will cause a data segment to be created; however, the warnings concerning that data segment may be ignored. However, if C run-time code is not being used in the DLL, __acrtused can be removed, and the C run-time code can also be removed from the DLL. The C run-time code is present in the standard import libraries xDLLCyW (where "x" is a memory model, and "y" is "E" for emulator math or "A" for alternate math). If the xNOCRTD libraries are used instead, no C run-time code is linked into the DLL. In addition to changing the library specification on the LINK command line, the /NOE option must be specified. To use the application's DS on a function-by-function basis, the NODATA option can be used on exports. When the linker fixes up a DLL entry point, it can be told to omit the code that changes DS on DLL entry. This can be done on a per-export basis, allowing much greater flexibility because a data segment can still exist, although it is only only set for certain calls. An example of this type of EXPORT statement is listed below (fragment of a .DEF file):
When "MyExportName" is called, it will not have the DS set to the
DLL's DS, instead it will retain the application's DS.
Additional query words: no32bit 3.00 3.10
Keywords : kb16bitonly |
Last Reviewed: November 4, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |