2

I'm using the Ruby interpreter embedded in the game Dwarf Fortress (it ships with 1.8.x, but I've replaced the DLL with 1.9.3), and I'm trying to include the Roo library so I can work with spreadsheets.

puts(RUBY_DESCRIPTION)

def addDir(libdir)
    $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
end 

addDir('C:\dev\Ruby193\lib\ruby')
addDir('C:\dev\Ruby193\lib\ruby\1.9.1')
addDir('C:\dev\Ruby193\lib\ruby\1.9.1\i386-mingw32')
addDir('C:\dev\Ruby193\lib\ruby\gems\1.9.1\gems\roo-2.1.1\lib')

require 'roo'

filename = "example.ods"
@spreadsheet = Roo::Spreadsheet.open(filename)
puts("Loaded " + filename + " with " + @spreadsheet.sheets.length.to_s + " sheets")

Script running on command line Script running in Dwarf Fortress' dfhack console

Running from the command-line, everything is fine, but trying inside the embedded interpreter results in an 'incompatible library version' error.

I'm clearly missing something about the different environments here - can anyone tell me how I'd go about successfully loading these libraries (I gather that although they are extended .so they are in fact DLLs) in an interpreted environment?

jimbofreedman
  • 332
  • 3
  • 10
  • could be a path issue? – Chase Aug 11 '15 at 13:14
  • Moving `stringio.so` results in the error becoming `cannot load such file - stringio`, so I'm reasonably confident it's being found. – jimbofreedman Aug 11 '15 at 13:34
  • hum... The `1.91` part of `Ruby193\lib\ruby\1.9.1'` is what concerns me. normally that would be the same as your ruby version, i.e. `1.9.3`, but this is a unique case and I'm not sure. – Chase Aug 11 '15 at 13:47
  • 1
    That had me surprised as well! That's how RubyInstaller left it and it works fine in the command-line. – jimbofreedman Aug 11 '15 at 14:00
  • Are you using dfhack? If so here is a relevant issue https://github.com/DFHack/dfhack/issues/271 – Chase Aug 11 '15 at 14:11
  • 1
    That looks very relevant (and ashamed I didn't find it myself) - I'll investigate this - thanks – jimbofreedman Aug 11 '15 at 16:05
  • No worries! I always dig into github issues when I try to answer SO questions. Let me know if you find anything. – Chase Aug 11 '15 at 16:11
  • It looks to me like there are some `cpp` files. I know the DevKit's compiler toolchain we are using cause some `c++` library interoperability breakage between versions. I would suggest recompiling `dfhack` with the DevKit of the Ruby you are using. "Just in Case". Also just to clear things up, 1.9.1 introduced a ABI breaking change. Until there's another ABI change the files are stored that way. Recently they've released a `minor` version change when the ABI changes. *e.g. `2.2.0` `2.3.0`* – Azolo Aug 11 '15 at 16:31

0 Answers0