Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > atexit() and DLLs

Reply
Thread Tools

atexit() and DLLs

 
 
Andreas Schmitt
Guest
Posts: n/a
 
      03-09-2007
Hi,

I'm using a phoenix singleton template in a DLL for windows which is using
the atexit()
function to call the objects destructor in case
the object had to be recreated with placement new after destruction.

Now.. how does the atexit() function work in this case? If atexit() is
called from within the DLL, will the secified
functions be called when the DLL is unloaded? (good)
Will they be called when the progam terminates? (bad)
Will this not work at all an crash for sure? (worse)

I'm using VC++ in case that makes a difference.

Thanks


 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Erik_Wikstr=F6m?=
Guest
Posts: n/a
 
      03-09-2007
On 2007-03-09 10:23, Andreas Schmitt wrote:
> Hi,
>
> I'm using a phoenix singleton template in a DLL for windows which is using
> the atexit()
> function to call the objects destructor in case
> the object had to be recreated with placement new after destruction.
>
> Now.. how does the atexit() function work in this case? If atexit() is
> called from within the DLL, will the secified
> functions be called when the DLL is unloaded? (good)
> Will they be called when the progam terminates? (bad)
> Will this not work at all an crash for sure? (worse)
>
> I'm using VC++ in case that makes a difference.


No, it does not because this is off topic here, where we discuss only
the C++ language itself. Your question is better asked in a win32-
programming group, perhaps you can find one in
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9


To answer your question: I don't think atexit() is the right function to
use, better would be to use DllMain(), pay special attention to the
fdwReason argument. More details can be found here
http://msdn2.microsoft.com/en-us/library/ms682583.aspx

--
Erik Wikström
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I install dlls and exes for libtidy and others? Kevin Ar18 Python 0 11-04-2009 06:06 PM
DLLs and CallWndRetProc and Timers Lindsay C++ 3 07-12-2005 07:04 PM
deploying applications and shared dlls C Evans via .NET 247 ASP .Net 0 05-23-2005 10:26 AM
.Net Dlls and ASP.NET app. ASP .Net 3 07-15-2003 02:47 AM
.net and dlls ana ASP .Net 2 06-30-2003 01:18 PM



Advertisments