How does WxRuby work ??

V

Vinh Chuc

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
 
P

Phillip Gawlowski

Vinh said:
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

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.. ;)

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/

Rule of Open-Source Programming #37:

Duplicate effort is inevitable. Live with it.
 
W

Wim Vander Schelden

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
 
V

Vinh Chuc

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 ????
 
P

Phillip Gawlowski

Wim said:
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".
 
R

Roy Sutton

Wim said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top