BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to release resource from dll when program quits.

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
Yu Xing
Guest





PostPosted: Fri May 18, 2007 6:33 am    Post subject: how to release resource from dll when program quits. Reply with quote



Hello everyone,
I use some dlls with a exe file,but I wanna know how to release the
resource from dlls when the application quit,because I want to do some
clearing work automaticly when dll closed. Where is position I should
put my clearing code at?

thanks

yu xing
Back to top
Bruce Salzman
Guest





PostPosted: Fri May 18, 2007 8:10 am    Post subject: Re: how to release resource from dll when program quits. Reply with quote



"Yu Xing" <mail2yzx (AT) 126 (DOT) com> wrote in message
news:464d0275 (AT) newsgroups (DOT) borland.com...
Quote:
Hello everyone,
I use some dlls with a exe file,but I wanna know how to release
the
resource from dlls when the application quit,because I want to do
some
clearing work automaticly when dll closed. Where is position I
should
put my clearing code at?


You might be able to use the DllEntryPoint function, depending on how
your resources are managed.

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*
lpReserved)
{
switch (reason) {
case DLL_PROCESS_ATTACH:
// allocate resource
break;
case DLL_PROCESS_DETACH:
// release resource
break;
}
return true;
}

--
Bruce
Back to top
Yu Xing
Guest





PostPosted: Fri May 18, 2007 8:10 am    Post subject: Re: how to release resource from dll when program quits. Reply with quote



Bruce,
Thank you, I got what I want.

yu xing
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.