From 4b73d28cfef419205dfe9b5984fa59ababbb70f1 Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Tue, 11 Aug 2026 01:44:37 -0400 Subject: [PATCH] atexit: Clarify DLL behavior is the same as _onexit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Document that atexit called from within a DLL will register the routine to run when the DLL is unloaded. atexit is a wrapper around _onexit which already documents this behavior. Ref: https://github.com/curl/curl/pull/22383#discussion_r3753438017 Reported-by: MichaƂ Petryka Closes #xxxx --- docs/c-runtime-library/reference/atexit.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/c-runtime-library/reference/atexit.md b/docs/c-runtime-library/reference/atexit.md index 1264498d49f..21ba2ddd15d 100644 --- a/docs/c-runtime-library/reference/atexit.md +++ b/docs/c-runtime-library/reference/atexit.md @@ -36,6 +36,8 @@ The **`atexit`** function is passed the address of a function *`func`* to be cal The code in the **`atexit`** function shouldn't contain any dependency on any DLL that could have already been unloaded when the **`atexit`** function is called. +In the case when **`atexit`** is called from within a DLL, routines registered with **`atexit`** run when the DLL is unloaded, after `DllMain` is called with `DLL_PROCESS_DETACH`. + To generate an ANSI-conformant application, use the ANSI-standard **`atexit`** function (rather than the similar **`_onexit`** function). ## Requirements