LIBMAIN

In addition to the functions you want to export (plus any supporting private routines), a DLL can contain an optional function called LIBMAIN (or its synonyms DLLMAIN and PBLIBMAIN). Windows calls LIBMAIN when a DLL is loaded into and unloaded from memory by an application. The use of LIBMAIN in your code is optional.

 

See Also

What is a Dll?

Creating a Dynamic Link Library

Private and Exported Procedures

Dll example