Dmitry Morozhnikov
2005-Apr-27 06:20 UTC
does anyone have success with wxruby with wxwidgets 2.6?
Hello, All. I`m trying to compile wxruby with wxwidgets 2.6 under windows with latest mingw, but have lot of troubles. wxwidgets and ruby 1.8.2 compiles just fine, examples work pretty well. To make wxruby compile (non-swig, from cvs) i was made some minor changes like explicit cast ("IN2NUM(...)" to "INT2NUM((long) ...)"), removed some constant definitions from const.cpp (pens, brushes, colors), removed wxEntryInitGui() from app.cpp because as i see it is dropped from wxwidgets completely. After all, it compiles now. But just any ruby script causes it to segfault. From a gdb i see a lot of wxwidgets messages about invalid window handle when trying to run samples/minimal/minimal.rb: warning: 19:11:41: In file ../src/msw/frame.cpp at line 441: ''SetMenu'' failed with error 0x00000578 (Недопустимый дескриптор окна.). warning: 19:11:41: In file ../include/wx/msw/private.h at line 335: ''GetClientRect'' failed with error 0x00000578 (Недопустимый дескриптор окна.). warning: 19:11:41: In file ../src/msw/statbr95.cpp at line 185: ''StatusBar_SetParts'' failed with error 0x00000578 (Недопустимый дескриптор окна.). (unreadable russian letters mean just -- "inappropriate window descriptor") When i`m trying to get HWND from ruby side with this code: require ''wxruby'' class App < Wx::App def on_init frame = Wx::Frame.new nil, -1, ''test'' puts frame.get_hwnd $stdout.flush end end App.new.main_loop I`m got: [src]$ ruby ../test.rbw 0 This application has requested the Runtime to terminate it in an unusual way. Please contact the application''s support team for more information. ../test.rbw:11: [BUG] Segmentation fault ruby 1.8.2 (2005-04-25) [i386-mingw32] As far as i`m understand this, it is generally should not happens because there is no much api changes between 2.4 and 2.6, but.. Can anyone show me the way to fight this trouble? BTW: What is a correct way to debug ruby extensions under windows? With gdb i can`t get symbols on stack with ''bt'' command, but everything -- ruby, wxwidgets, wxruby is compiled with -g. -- Dmitry mailto:dmiceman@ubiz.ru
Kevin Smith
2005-Apr-27 09:29 UTC
[Wxruby-users] does anyone have success with wxruby with wxwidgets 2.6?
Dmitry Morozhnikov wrote:> Hello, All. > > I`m trying to compile wxruby with wxwidgets 2.6 under windows with > latest mingw, but have lot of troubles.My guess is that wxwidgets 2.6 is not being properly initialized by wxruby. The code that performs the initialization is somewhat of a hack, relying on undocumented wxwindows 2.4 calls. It is quite possible that 2.6 must be initialized using different calls, or in a different order. In wxruby 0.6, this code is spread between WxApp::Init, wxAppWithCallbacks::MainLoop, and the Init_wxruby() function in wx.cpp. In wxruby-swig, the initialization is simpler, and can be seen in swig/classes/App.i in main_loop. In fact, this code *might* just work with 2.6 as-is, but I don''t think anyone has tried it. There would probably be other parts of wxruby-swig that would need to change, which is also true with wxruby-0.6. Kevin
Dmitry Morozhnikov
2005-Apr-27 12:09 UTC
[Wxruby-users] does anyone have success with wxruby with wxwidgets 2.6?
Hello, Kevin. You wrote 27.04.2005, 22:35:48: Thank you for reply. You pointed me to the right place! :-) Well.. There is a patch attached which allow me to compile wxruby and run samples/minimal/minimal.rb Main thing is to call wxAppWithCallbacks::Initialize() manually. But! It is not state of the art patch, it is just an ugly hack because i still does not understand wxwidgets initialization procedures. I just found a place where window classes being registered and call it. -- Dmitry mailto:dmiceman@ubiz.ru -------------- next part -------------- A non-text attachment was scrubbed... Name: wxwidgets-2.6.diff Type: application/octet-stream Size: 9833 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20050428/5fa44022/wxwidgets-2.6-0001.obj
Nick
2005-Apr-27 22:05 UTC
[Wxruby-users] does anyone have success with wxruby with wxwidgets 2.6?
Thanks for the patch. I will apply it as soon as I can. Right now the plan is to have wxruby-swig support next gen wxWidgets, and let the old codebase support wxWidgets 2.4. Nick Dmitry Morozhnikov wrote:> Hello, Kevin. > > You wrote 27.04.2005, 22:35:48: > > Thank you for reply. You pointed me to the right place! :-) > > Well.. There is a patch attached which allow me to compile wxruby and > run samples/minimal/minimal.rb > > Main thing is to call wxAppWithCallbacks::Initialize() manually. > > But! It is not state of the art patch, it is just an ugly hack because > i still does not understand wxwidgets initialization procedures. I > just found a place where window classes being registered and call it. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
Joao Pedrosa
2005-Apr-27 22:11 UTC
[Wxruby-users] does anyone have success with wxruby with wxwidgets 2.6?
Hi, On 4/27/05, Nick <devel@nicreations.com> wrote:> > Thanks for the patch. I will apply it as soon as I can. > > Right now the plan is to have wxruby-swig support next gen wxWidgets, > and let the old codebase support wxWidgets 2.4.That''s cool. I''m anxiously waiting to test the new version. I''ve started experimenting with wxRuby and I like what I see. Thanks for it. Cheers, Joao
Dmitry Morozhnikov
2005-Apr-28 07:14 UTC
[Wxruby-users] does anyone have success with wxruby with wxwidgets 2.6?
Hello, Nick. You wrote 28.04.2005, 11:08:36: N> Thanks for the patch. I will apply it as soon as I can. Thank you! :-) But please use new patch (attached). At least, it returns back default colors, pens and brushes (i`m divide constants initialization into two parts, second part is called after wxApp::Initialize()). I`m test this version of wxruby with my own app which is complex enough and all looks fine for me. N> Right now the plan is to have wxruby-swig support next gen wxWidgets, N> and let the old codebase support wxWidgets 2.4. Hmm.. Can`t agree with you :-) What is advantages of using SWIG to create wrappers? I found what SWIG is too complex, too complicated and absolutely unnecessary to use it. Plain wxruby is a best demonstration of that :-) Anyway, may be it is possible to label wxruby 0.6 as a last version for wxwidgets 2.4 and go further? -- Dmitry mailto:dmiceman@ubiz.ru -------------- next part -------------- A non-text attachment was scrubbed... Name: wxwidgets-2.6-2.diff Type: application/octet-stream Size: 12368 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20050428/e7a0bc63/wxwidgets-2.6-2.obj
Kevin Smith
2005-Apr-28 09:59 UTC
[Wxruby-users] does anyone have success with wxruby with wxwidgets 2.6?
Dmitry Morozhnikov wrote:> What is advantages of using SWIG to create wrappers? I found what SWIG > is too complex, too complicated and absolutely unnecessary to use it. > Plain wxruby is a best demonstration of that :-)I was the maintainer of wxruby for a while, and initiated the move to swig. Originally I also thought that swig was too complicated, and I didn''t want to use it. But after actually working with it, I see that it really is much easier than other approaches. Not only is it much easier to support additional classes and methods using swig, but it is also far easier to support global features like clean memory management, and the ability to subclass C++ classes in Ruby, and to have proper callbacks. In my opinion, wxruby-swig is far superior to the older wxruby code. I believe if the goal is a top-notch wxruby, it will be much easier and faster to get there using wxruby-swig. However, if you want to improve the older wxruby code, I can''t imagine anyone complaining. Kevin