How does WxRuby work?

Hi !
I have a question about the WxRuby toolkit, i never used a gui
toolkit before ( mainly coded php apps and maths algorithms with caml so
far ), but i guess it works like that :
_ for a compiled program ( for example C/C++ ), the toolkit library, is
either already installed on the end user computer, either it is
“included” in the source code and compiled with it
_ but for an interpreted language, how does it work ??? do the end user
have to install a specific wxwidgets library ? or does wxruby provide a
file that we have to bundle with the .rb files ???

thanks

Vinh C. wrote:

thanks

Ever used GTK+ applications on Windows (GIMP, for example)?
Although GTK+ apps are usually compiled C code, you have to install the
GTK GUI toolkit.

Ruby works similar: You have to install the GUI toolkit, and have to
‘require’ it. In distribution, you either have to redistribute it
(including Windows builds, for example), or have it as a gem dependency,
or need to mention it in your INSTALL file… :wink:


Phillip “CynicalRyan” Gawlowski
http://cynicalryan.110mb.com/

Rule of Open-Source Programming #37:

Duplicate effort is inevitable. Live with it.

Hi Vinh,

The way ruby interfaces with native libraries (such as wxWidgets) is
very similar to a compiled program. You have to write an “extension” (in
the case of wxWidgets there already is an extension, wxRuby), which is
then linked with the library (wxWidgets). To install such an extension,
you probably want to use gems. You can get a binary for Windows, linux
or Mac OS X using ‘gem install wxruby2-preview’.

You already need to have wxWidgets installed, if I’m not mistaken,
preferably in you C:\Windows\system32 directory.

Wim

yeah, i remember that when installing Gimp when i was on Windows XP, i
had to install the gtk toolkit (now i’m on a linux box )

if i understood, the end user has to install the WxWidgets library, on
windows are those libraries included by default ?? if not then the end
user has to install them just as the gtk toolkit
on the WxWidgets site, i can only find .exe for developers

on linuxes, i think they are included is most distros ( i check my
synaptic package manager )

But, as Ruby is an interpreted language, how does the ruby interpreter
“understand” the wxruby lines in the .rb files ??? does the end user
have to install some additional programs ???

Wim Vander S. wrote:

The way ruby interfaces with native libraries (such as wxWidgets) is very similar to a compiled program. You have to You already need to have wxWidgets installed, if I’m not mistaken, preferably in you C:\Windows\system32 directory.

On Windows, at least, wxWidgets does not need to be installed. It is
compiled into the gem. On Linux, you need GTK+ installed. Others will
have to comment on Mac. We do have a mailing list for wxRuby
questions. You’ll get good answers here:

http://rubyforge.org/mail/?group_id=35

Roy

Wim Vander S. wrote:

You already need to have wxWidgets installed, if I’m not mistaken, preferably in you C:\Windows\system32 directory.

Yes, but no. Yes, you need to have it installed, but, for heaven’s sake,
not in %WINDIR%\system32, or anywhere below %WINDIR%. Libraries, used by
multiple programs (like wxWidgets), should go into %APPDATA%, or their
path should be added to %PATH% (easiest way to do that in Ruby:

system(“path %path%;#{mypath}”)

You should never, ever copy your files into %windir%, unless you are a
driver vendor. That’s a really, really bad habit carrying over from (at
least) Windows 3.x.


Phillip “CynicalRyan” Gawlowski
http://cynicalryan.110mb.com/

Rule of Open-Source Programming #11:

When a developer says he will work on something, he or she means
“maybe”.