From: Bryce Date: 1999-01-14T21:52:02-05:00 Subject: [ruby-talk:00183] finalizer help please Here is my code: !!! start here require 'WINGKR' require 'final' require 'delegate' class WinControl def initialize () @createdFromHandle = false @handle = 0 @autoDestroy = false @destructor = WinControl.destructor ( self ) ObjectSpace.define_finalizer(self, @destructor ) end def WinControl.destructor ( obj ) lambda { require 'WINGKRUser32' print "\n\r destructor" print "\n\r obj is: ", obj.type print "\n\r obj value is: ", obj print "\n\r obj handle is: ", obj.handle if @handle != 0 then if DestroyWindow ( @handle ) != 0 then print "\n\r Destroyed: ", @handle else print "\n\r Could NOT destroy: ", @handle end end } end !!! end here My problem is that the DestroyWindow function does not get called and I get : undefined method 'DestroyWindow' for WinControl However, the method DestroyWindow is defined in the WINGKRUser32 module which I did 'require' in the lambda {...} section of the 'destructor'. Could someone help on this please? Thanks. Bryce