Archived

This topic is now archived and is closed to further replies.

_release? Releasing DX surfaces in Delphi

This topic is 6111 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know COM objects in Delphi are reference counted. If I have structures where I store IDirectDrawSurface7''s, and I want to say, free them and load different textures repeatedly during runtime (for example, level changes), how do I free them? Are they automatically released when I recreate them, so I don''t need to do anything? Is there an equivalent procedure to the C++ SafeRelease() macro? I notice the objects have a method _release(). Should I be calling that? Why does it begin with an underscore? Thanks.

Share this post


Link to post
Share on other sites
once you have created a surface, you can use it, abuse it until you're done with it. ( the end of the program).

then just point it to nil and the rest will go out of scope.

You would call _release if you had previously retreived an interface to that surface for some reason.
example, in directx8 they give you acess to the texture but all of the neet functions are only valid for surfaces, so you would retreive a surface interface out of that texture, then call whatever surface operation and then call _release to free the resource.

for the _ , it's a c++ convention.
on the other side,
c++ programmers ask, why do pascal people use the letter T in front of everything.
Because it makes c++ programmers ask about it

sorry i'm in a silly mood today.

Best regards,

Gunner.


Edited by - gunner on March 22, 2001 1:38:25 PM

Share this post


Link to post
Share on other sites