What function in a C .DLL is executed first when LoadLibraried?
- User
What function in a C .DLL is executed first when LoadLibraried?
- Assistant
In the context of a C DLL (Dynamic Link Library) on Windows, the function that is typically executed first when the DLL is loaded into a process via
LoadLibrary(or automatically at process startup if the DLL is specified as a dependency) isDllMain. The system calls theDllMainfunction with theDLL_PROCESS_ATTACHvalue when a process loads the DLL. The same function is also called with different arguments for other events, such as when a thread is created or destroyed (, ) and when the DLL is unloaded ().