windows - 在DllMain中,是否可以在没有DLL_THREAD_ATTACH的情况下发生DLL_THREAD_DETACH?

标签 windows dll

如果在加载我的 DLL 之前线程已经创建。然后,线程在我的 DLL 卸载之前退出。问题是:

我的 DllMain 将收到 DLL_THREAD_DETACH 通知,还是不会收到有关退出线程的通知?

感谢您的提前。

最佳答案

您会收到通知。它明确记录在 MSDN article 中对于 DllMain:

There are cases in which the entry-point function is called for a terminating thread even if the entry-point function was never called with DLL_THREAD_ATTACH for the thread:

  • The thread was the initial thread in the process, so the system called the entry-point function with the DLL_PROCESS_ATTACH value.
  • The thread was already running when a call to the LoadLibrary function was made, so the system never called the entry-point function for it.

关于windows - 在DllMain中,是否可以在没有DLL_THREAD_ATTACH的情况下发生DLL_THREAD_DETACH?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21026984/

相关文章:

windows - Windows Web Server 2008 R2 上的 Datasnap/DCOM

windows - 如何在 Appveyor 中安装 GHC 并将 GHC 放在路径中?

c - 在没有库的情况下在 C 中使用 DLL

c# - 如何将多个dll包装在一个dll中

java - 在 VBA/Excel 中使用 IKVM 编译的 Java .dll?

windows - 在 Windows 上配置 stunnel 和 openssl 以支持 TLS 1.2

windows - 如何解决宏长度超过 2500 行,这可能需要很长时间才能加载

c - Delphi 中通过引用传递的指针(从 DLL 导入函数)

C# :Does Client machine need SQL Server installed on it while connecting to other machine having SQL Server installed on it (the Server machine)

Windows Powershell 有时不输出任何值(温度传感器)