[R] cannot dyn.load dll from path

Adrian Dragulescu adrian_d at eskimo.com
Thu Jan 19 19:42:59 CET 2012


It doesn't work even if I set it with \\.  My path has a mixture of \\ and 
/ and other entries work fine.

if (file.exists("C:/Temp/XML.dll")) {
   Sys.setenv(path = paste("C:\\Temp;C:/Temp;", Sys.getenv("path"), sep=""))
   dyn.load("XML.dll")   # doesn't find it!
}
Error in inDL(x, as.logical(local), as.logical(now), ...) :
   unable to load shared object '//nas-msw-20/adrian/My Documents/XML.dll':
   LoadLibrary failure:  The specified module could not be found.
>

My home folder is on a network drive.

Thank you,
Adrian



On Thu, 19 Jan 2012, Duncan Murdoch wrote:

> On 19/01/2012 11:19 AM, Adrian Dragulescu wrote:
>> Hello,
>> 
>> I'm on Windows, and according to the documentation R searches along the
>> search path when looking for dll's for dyn.load.
>> 
>> For illustration, I've copied the XML.dll from package XML in the C:/Temp
>> folder
>>
>>     if (file.exists("C:/Temp/XML.dll")) {
>>       Sys.setenv(path = paste("C:/Temp;", Sys.getenv("path"), sep=""))
>>       dyn.load("XML.dll")   # doesn't find it!
>>     }
>> 
>>
>>     head(strsplit(Sys.getenv("path"), ";")[[1]])  # C:/Temp is there
>>
>>     dyn.load("C:/Temp/XML.dll")  # works fine
>> 
>> Am I misreading the documentation?
>
> I believe that search is done by Windows, and different versions are very 
> inconsistent about search order.  However, one thing I would guess is that 
> recent versions would require backslashes rather than forward slashes in 
> PATH.  When R gets a path, it generally translates the slashes, but if you're 
> relying on Windows to do it, you're stuck with what they decide to do.
>
> Duncan Murdoch
>



More information about the R-help mailing list