From: Dave Burt Date: 2005-03-24T05:39:54+09:00 Subject: Re: Using DL on Windows "Stephan K�mper" 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. > > 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 > > 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