[Rd] Finding windows DLLs

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 7 22:50:56 CET 2008


On Mon, 7 Jan 2008, Duncan Murdoch wrote:

> On 1/7/2008 2:51 PM, Martin Morgan wrote:
>> The XML package relies on libxml2.dll (e.g., bundled with the CRAN
>> binary) installed in library/XML/libs. Unfortunately,
>> c:/WINDOWS/system32/libxml2.dll will be found and loaded before
>> this.
>>
>> Is there any programatic solution?
>
> Search order for DLLs is version dependent on Windows.  The best way to
> be sure of what you're loading is to fully specify the path to the DLL,
> and this generally requires you to use API calls LoadLibrary() and
> GetProcAddress() rather than relying on automatic loading of dependencies.
>
> I don't know how many entry points XML is importing from libxml2.dll; if
> there are a lot, LoadLibrary() will be a pain to use, and it might be
> easiest to rename libxml2.dll and hope to avoid a collision.

About 85.  But it's worse than that, as libxml2.dll itself imports from 
zlib1.dll and iconv.dll, and there is one of the latter in the application 
directory in R >= 2.6.0.  So even if you find the right libxml2.dll, you 
may not find the right zlib1.dll and iconv.dll (and I already knew that 
you found R's iconv.dll, which fortunately works).

I think we do need to provide an interface to SetDllDirectory, probably as 
an additional argument to dyn.load.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list