17.4. Understanding a Simple DLL

Looking at Listings 17.1 through 17.7, you can see that two of the files are completely normal. Listing 17.1 is the implementation of the DLL function, and it contains no surprises. Listing 17.5 contains the code for the application, and it is normal as well.

The header file in Listing 17.2 is easy to understand. It contains a standard prototype for MultiHonk. The prototype is wrapped in the extern "C" statement to tell the C++ compiler to turn off its name mangling. DLL files as shown here contain normal C functions.

The DEF file in Listing 17.3 is new. DLLs rely on the Library Manager to build the LIB file that the application needs in order to link to the DLL. The DEF file declares for the Library Manager the ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.