Thread overview | |||||
---|---|---|---|---|---|
|
April 03, 2005 GC and win32 | ||||
---|---|---|---|---|
| ||||
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? |
April 03, 2005 Re: GC and win32 | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | 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. |
April 03, 2005 Re: GC and win32 | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | 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 |
Copyright © 1999-2021 by the D Language Foundation