Loading external DLLs (e.g. stringio.so) in embedded Ruby interpreter

153 Views Asked by At

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?

0

There are 0 best solutions below