From: nobu.nokada@... Date: 2002-09-13T11:16:16+09:00 Subject: Re: RubyInline and CrossPlatform concerns (was: Windows XP : RubyInline 1.0.4 Released!) Hi, At Fri, 13 Sep 2002 02:40:47 +0900, Ryan Davis wrote: > > tmpdir = ENV['TMP'] + "/.ruby_inline" > > I've left /tmp in favor of the home directory. Is there something like > ENV['HOME'] on win? As to NT series, HOMEDRIVE and HOMEPATH are set. It may be better to set HOME to %HOMEDRIVE%%HOMEPATH%, %USERPROFILE%, or "My Documents" directory, in NtInitialize(). > > # Compiling > > cmd = "#{cc} -o #{so_name} #{src_name} #{libs}".gsub('/','\\') + > > " -link /INCREMENTAL:no /EXPORT:Init_#{mod_name}" > > `#{cmd}` > > end > > Why didn't rbconfig add the -link line that you have above? I'm not > willing or able to accept this change as-is, because that _should_ be > part of your rbconfig setup, if it isn't, then that wasn't the way > ruby was built and it is suspect. This change makes this section no > longer platform independent. This is further tangled by the gsub, as > if the -link section did come from rbconfig, then the gsub would mess > it up. Extension library may have exported symbols other than initializer. So mkmf.rb uses .def file rather than linker option. You could do: system(Config::CONFIG["ruby_install_name"], "-rmkmf", "-e", "create_makefile('#{mod_name}')") > Finally, the ".gsub('/', '\\')" is also not platform independent. I'm > frustrated that it's even necessary. As I understand it, perl just > automatically changes things like that (at least on open and other > obvious file references). Python has the very useful 'os' module. Is > this something that we need? How should I deal with this? This isn't `open' nor `obvious file references'. How about this? class << File if File::ALT_SEPARATOR def extern_path(f) f.gsub(SEPARATOR, ALT_SEPARATOR) end else alias extern_path dup end end cmd = "#{cc} -o #{so_name} #{src_name} #{File.extern_path(libs)}" -- Nobu Nakada