[fpc-pascal] Interface reference counting

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Thu Apr 2 13:46:41 CEST 2009


Hello,

Just to be sure, when using an interface from COM, can I just ignore
it and the compiler will release it when it's scope ends, or do I need
to manually set the variable to nil?

var
  d3d: IDirect3D9 = nil; // Direct3D interface
begin
  // create the Direct3D interface
  d3d := Direct3DCreate9(D3D_SDK_VERSION);

  // ... use the interface here

  d3d := nil; // necessary or not?
end;

thanks,
-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list