digitalmars.D - GC and win32
- bobef (5/5) Apr 03 2005 For some Win32 functions, like ImageList_GetIcon, msdn says:
- Stewart Gordon (8/15) Apr 03 2005 D knows nothing of Windows system objects. As such, you have to delete
- Ben Hinkle (8/13) Apr 03 2005 It depends on how you keep track of the icon. If you store it in an obje...
For some Win32 functions, like ImageList_GetIcon, msdn says: It is the responsibility of the calling application to destroy the icon returned from this function using the DestroyIcon function. But it is written for C. There is no GC. Do this apply to D also or the GC will take care of it?
Apr 03 2005
bobef wrote:For some Win32 functions, like ImageList_GetIcon, msdn says: It is the responsibility of the calling application to destroy the icon returned from this function using the DestroyIcon function. But it is written for C. There is no GC. Do this apply to D also or the GC will take care of it?D knows nothing of Windows system objects. As such, you have to delete them yourself. Of course you can create a wrapper class with a destructor to do this work. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on on the 'group where everyone may benefit.
Apr 03 2005
In article <d2pegv$i1$1 digitaldaemon.com>, bobef says...For some Win32 functions, like ImageList_GetIcon, msdn says: It is the responsibility of the calling application to destroy the icon returned from this function using the DestroyIcon function. But it is written for C. There is no GC. Do this apply to D also or the GC will take care of it?It depends on how you keep track of the icon. If you store it in an object then you can use the object destructor to release the icon. Otherwise you have to explicitly release the icon when you are done with it. See the section http://www.digitalmars.com/d/class.html#destructors and http://www.digitalmars.com/d/garbage.html -Ben
Apr 03 2005