Project

General

Profile

Bug #2789 ยป dl_18_callback_mingw32.rb

Script to reproduce segfault on mingw32 - Ethan (Ethan -), 02/25/2010 02:19 AM

 
1
require 'dl'
2
user32=DL.dlopen("user32")
3

    
4
enum_windows_callback= DL.callback('ILL') do |hwnd,lparam|
5
  puts "hwnd is #{hwnd}"
6
  0 # return 0 to break the enumeration early
7
end
8
begin
9
  puts "calling enumwindows ..."
10
  ret, args=user32['EnumWindows', 'IPL'].call(enum_windows_callback, 0)
11
  puts "called enumwindows."
12
ensure
13
  puts "removing callback ..."
14
  DL.remove_callback(enum_windows_callback)
15
  puts "removed callback"
16
end