[fxruby-users] ruby-1.8.5 loads fox16.so more than once

DeeJay smartgpx at gmail.com
Wed Sep 13 03:46:48 EDT 2006

re: 'noise' about Constants from multiple loads of fox16.so

I have no deep understanding of what is wrong, but I note that the problem
also occurs with the Windows version of ruby.
My ruby installations are all created with various releases of the
OneClickInstaller [oci].

The problem seems to be triggered by require'ing fox. Using oci185-21 with
ruby 1.8.5 (2006-08-25) [i386-mswin32] this behaviour is seen with both fox
16 AND fox12. I didn't see it with whatever recent binary of ruby1.8.4 was
shipped with oci184-19, with either fox12 or fox16.

To try to 'step through' the problem without a debugger - which I wouldn't
understand - I renamed the
subdirectory and created an empty one.

Then by successively requireing fox16 and importing the library files
reported as missing I was able to see when the redefined Constant problem
was triggered. By observation, any file in ..\lib\fox16 which itself
contains the line "require 'fox16'" was the trigger for the redefined
Constant warnings. By commenting out these 'require' lines I have created a
minimal copy of ..\lib\fox16  [containing 15 .rb files] which allows a
simple FXruby application (like hello.rb) to start up silently.

I make no recommendation that this is a correct or safe thing to do with the
fxruby libraries, but I thought I should share what I had found, in the hope
that it may lead to a supported and released solution.

fwiw, this is what ri has to say about Kernel#require -

"  The name of the loaded feature is added to the array in $". A feature
will not be loaded if it's name already appears in $". However, the file
name is not converted to an absolute path, so that ``require 'a';require
'./a''' will load a.rb twice. "

DeeJay, Leicester, UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20060913/99d8fb75/attachment.html 

More information about the fxruby-users mailing list