DLL unloading itself
问题 Is it possible for a function that is inside a DLL to unload the DLL? I need to do this so I can make sure the DLL is not in use, then write to the DLL's file. 回答1: I don't think it will work. Calling FreeLibrary with a handle from the outside (LoadLibrary would have been called from an area outside the DLL) as the code runs in a memory location that will not be valid anymore. Even if this is possible, it smells like a bad design. Maybe you want to make some updater or alike. Explain a bit