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? Thanks, Martin -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M2 B169 Phone: (206) 667-2793
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. Duncan Murdoch
Should adding PREFIX/library/XML/libs to PATH before system32 solve the issue as Windows relies on PATH when searching for libs as well? Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466 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? > > Thanks, > > Martin
On Mon, 7 Jan 2008, Oleg Sklyar wrote:> Should adding PREFIX/library/XML/libs to PATH before system32 solve the > issue as Windows relies on PATH when searching for libs as well?The Windows code for package XML says> XML:::.onLoadfunction (libname, pkgname) { if (.Platform$OS.type == "windows") { temp <- Sys.getenv("PATH") Sys.setenv(PATH = paste(utils::normalizePath(file.path(libname, pkgname, "libs")), temp, sep = ";")) on.exit(Sys.setenv(PATH = temp)) } library.dynam("XML", pkgname, libname) if (exists("setMethod")) { } .C("RSXML_setErrorHandlers") } <environment: namespace:XML> so it does already do that. The order depends on the version of Windows *and* its settings: see http://msdn2.microsoft.com/en-us/library/ms682586(VS.85).aspx There is a way to change this: http://msdn2.microsoft.com/en-us/library/ms686203(VS.85).aspx but it would preclude Windows 2000. Perhaps Martin can explain how libxml2.dll got into c:/WINDOWS/system32/? My suggestion is that we rename the DLL when copied into library/XML/libs to something like libRxml2.dll.> > Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466 > > > 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? >> >> Thanks, >> >> Martin-- 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