SUMMARY
=======

The MTDLL sample illustrates several techniques and concepts related to
multithreaded programming in Windows NT. The sample uses a multithreaded
DLL to implement six sorting algorithms. The DLL is called into from an
MFC application which uses a dialog box as the main window. The six
sorting algorithms implemented are the Bubble sort, Exchange sort, Heap
sort, Insertion sort, Quick sort, and Shell sort.


MORE INFORMATION 
================

Some of the multithreaded concepts and techniques illustrated by the
sample are:

    Conditionally using __declspec(dllexport) and __declspec(dllimport)
    on function prototypes which reside in a header file which is included
    in both the DLL and the calling application.

    Using  __declspec(thread) to allocate thread-local data

    Using a critical section object to control access to the display

    Handling termination of a currently executing thread

    Using _beginthread() and _endthread() to handle thread creation and
    termination

The calling executable and the sorting DLL in this sample also use mutual
imports. That is, the executable calls routines which have been exported
from the DLL and the DLL calls routines which have been exported from the
executable. The sample includes the import libraries needed to build both
the DLL and the calling executable. However, if the sample is modified and
additional functions are exported from both the executable and the DLL,
the mutual imports could make it imposible to build either the DLL or the
executable, since one must be built before the other. This situation can
be worked around by using the LIB utility with the /DEF option to build an
import library from a linker .DEF file. This technique is discussed in
chapter 4 of the Programming Techniques manual and chapter 3 of the Build
Tools User's Guide supplied with Visual C++ for Windows NT.

This sample does not use .DEF files to specify exported functions. It
illustrates using __declspec instead. However, the sample does include
.DEF files for the DLL and the executable which can be used as starting
points if at some point the LIB utility needs to be used with the /DEF
option to solve the problem of mutual imports.

This sample also uses CTL3D32.DLL to implement a 3-D look for it's dialog
box controls. In order for CTL3D32.DLL to work, it must be copied from the
multithreaded DLL sample directory to the Windows NT SYSTEM32
subdirectory, for example C:\WINNT\SYSTEM32. After copying the DLL, it
must be deleted from the multithreaded DLL sample directory. If
CTL3D32.DLL is not copied to the \WINDOWS\SYSTEM32 directory and deleted
from the multithreaded DLL sample directory, a message box with the
following error will be displayed when the sample is run:

    This application uses CTL3D32.DLL, which has not been correctly
    installed.

After selecting OK to dismiss the message box, the main dialog box of the
sample will be displayed but it will be using a white background and none
of the dialog box controls will be 3-D.

This sample was compressed with the PKWARE compression utility. The
compressed file contains subdirectories. Because of this, the -d switch
needs to be used when decompressing the file to disk.

