I am trying to load a dll using the following fiddle code: ( If there is a easier way to load a dll and call a function on it that would solve my problem I am happy to hear it )
require 'fiddle' unless defined?(Fiddle)
require 'fiddle/import' unless defined?(Fiddle::Importer)
extend Fiddle::Importer
dlload "Foo.dll"
dlload "C:/Folder/Foo.dll"
works like I want. But the problem is that Foo.dll is a c++ dll that requires several other dlls in various locations.
How do I go about just calling dlload "Foo.dll"
without a full path. In short how do I add a list of directories to the Ruby dll search path?
I have tried the following:
$LOAD_PATH.unshift("C:/Folder")
ENV['RUBYLIB'] = "C:/Folder"
ENV['LD_LIBRARY_PATH'] = "C:/Folder"
The ruby interpreter is running inside another program (Sketchup), so my environment is restricted.
The only solution I got to work was writing a small kernel32.dll library and calling AddDllDirectory from within it.