Dave Burt
3/23/2005 8:38:00 PM
"Stephan Kämper" <Stephan.Kaemper@Schleswig-Holstein.de> asked:
> Hi all,
>
> I'm trying to tie together some Ruby code with a DLL (let's call it
> 'one.dll') which in turn uses another DLL. That other DLL is Xerces, but
> that shouldn't matter much.
>
> Now, if both of the two DLLs are located in the same directory as the Ruby
> code things work fine.
> <snip>
> Now, they're DLLs after all and I'd like to put both of them in another
> directory, e.g. 'libs'. In that case I'd write
>
> dl_name = DL.dlopen( "libs/one.dll" )
> version = dl_name[ "version_of_XY" , "s" ]
> puts "Version is : #{ version.call }"
>
> and get an error:
>
> dll_test.rb:47:in `initialize': unknown error (RuntimeError)
> from dll_test.rb:47:in `dlopen'
> from dll_test.rb:47
> <snip>
> So, my question is: How can I tell DL and/or Ruby where to look for
> 'secondary' DLLs? Apparently I have to take care about some kind of path
> I'd guess. But which one?
>
DLLs need to be any one of:
* in the working directory,
* in the PATH,
* registered (regsvr32.exe one.dll) or
* referenced directly.
You should be able to do any of these first 3 quite easily. If you want them
in lib/, then I'd go for number 2:
ENV['PATH'] += ";.\\lib;" # UNTESTED
Cheers,
Dave