From: Mark Hahn Date: 2001-12-28T11:01:52+09:00 Subject: [ruby-talk:29504] Need windows extension dll help I have been trying to build and run ruby-gtk in windows for some time. This is my first attempt to do such a thing. I have discovered the hard way that gtk itself cannot be built in cygwin and that ruby-gtk cannot be built in mingw. This leaves me with mswin32. I built ruby and ruby-gtk in mswin32 with standard makefiles. When I did a require 'gtk' statement I got an error. I didn't know how to debug with the mswin32 makefiles so I created two projects in MSVC 5.0 for Ruby and ruby-gtk. When I ran the same require 'gtk' in that environment I got the exact same error. This is the error: helloworld.rb:8:in `require': 998: Invalid access to memory location. - C:/RUBY/lib/ruby/1.6/i586-mswin32/gtk.dll (LoadError) from helloworld.rb:8 I then ran the debugger and watched Ruby make this windows library call: LoadLibraryExA("c:/ruby/lib/ruby/1.6/i586-mswin32/gtk.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) which returned the 998 error above. I came across a utility called Dependency Walker that logs all dll activity while Ruby is running. This is the log showing my problem: LoadLibraryExA("c:/ruby/lib/ruby/1.6/i586-mswin32/gtk.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "c:\ruby\RUBY.EXE" at address 0x004100C0. Loaded "c:\ruby\lib\ruby\1.6\i586-mswin32\GTK.DLL" at address 0x10000000. Successfully hooked module. Loaded "c:\ruby\bin\MSWIN32-RUBY16.DLL" at address 0x00D80000. Successfully hooked module. DllMain(0x00D80000, DLL_PROCESS_ATTACH, 0x00000000) in "c:\ruby\bin\MSWIN32-RUBY16.DLL" called. DllMain(0x00D80000, DLL_PROCESS_ATTACH, 0x00000000) in "c:\ruby\bin\MSWIN32-RUBY16.DLL" returned 1 (0x1). DllMain(0x10000000, DLL_PROCESS_ATTACH, 0x00000000) in "c:\ruby\lib\ruby\1.6\i586-mswin32\GTK.DLL" called. First chance exception 0xC0000005 (Access Violation) occurred at address 0x00104E30. DllMain(0x00D80000, DLL_PROCESS_DETACH, 0x00000000) in "c:\ruby\bin\MSWIN32-RUBY16.DLL" called. DllMain(0x00D80000, DLL_PROCESS_DETACH, 0x00000000) in "c:\ruby\bin\MSWIN32-RUBY16.DLL" returned 1 (0x1). Unloaded "c:\ruby\lib\ruby\1.6\i586-mswin32\GTK.DLL" at address 0x10000000. Unloaded "c:\ruby\bin\MSWIN32-RUBY16.DLL" at address 0x00D80000. This log says that DllMain in GTK.DLL was called, then the exception occured before dllmain returned. But there is no dllmain in ruby-gtk! I am stuck trying to find out why the dll cannot be loaded. Can someone give me a clue how to find out what is wrong?