[Rd] Managing DLLs with the same names in an R session

Patrick Aboyoun paboyoun at fhcrc.org
Fri Apr 24 19:38:17 CEST 2009


I am having a problem using two DLLs with the same name, but obviously 
located in different directories, in an R session. The troublesome 
package is the (Bioconductor) Rgraphviz package. It relies on (3rd party 
software) graphviz and imports functions from (Bioconductor) package 
graph. Unfortunately, the current stable release of graphviz for Windows

http://www.graphviz.org/pub/graphviz/stable/windows/graphviz-2.22.2.msi

contains a graph.dll in its bin directory. The situation is that 
Rgraphviz needs to link to the graph.dll from graphviz,

E:\paboyoun>..\biocbld\bbs-2.4-bioc\R\bin\R CMD build Rgraphviz
[...omitting output...]
** libs
  making DLL ...
[...omitting output...]
gcc -shared -s -o Rgraphviz.dll tmp.def LL_funcs.o Rgraphviz.o 
RgraphvizInit.o agopen.o agread.o agwr
ite.o bezier.o buildEdgeList.o buildNodeList.o doLayout.o 
graphvizVersion.o init.o -LC:/Graphviz2.22/
bin -lgvc -lgraph -lcdt -Le:/biocbld/bbs-2.4-bioc/R/bin -lR
[...omitting output...]

but at run time R dispatches to the graph.dll from the graph package to 
resolve the symbols.

R-2.9> Sys.which("graph.dll")
                        graph.dll
"C:\\GRAPHV~1.22\\bin\\graph.dll"
R-2.9> library(Rgraphviz)
Loading required package: graph
Loading required package: grid

<< Message box appears:  The procedure entry point agclose could not be 
located in the dynamic link library graph.dll >>

Running Rterm.exe through the DependencyWalker software, I see that the 
gvc.dll and cdt.dll graphviz libraries are properly loaded, but the 
graph.dll dependency of Rgraphviz.dll links to the graph.dll library 
from the graph package. I tried passing the DLLpath for graphviz to the 
library.dynam function call when loading Rgraphviz.dll in the .onLoad 
function within Rgraphviz and it had no effect. I also tried 
library.dynam.unload/dyn.unload-ing the graph.dll from the graph package 
and then loading the Rgraphviz.dll followed by the reloading of the 
graph.dll from the graph package and the graph.dll dependencies become 
broken to the point that a call out to a graph.dll results in a GPF.

Is is possible to manage DLLs with the same name from R or do I need to 
rename one of the DLL names to make them unique?

 > sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] graph_1.22.0

loaded via a namespace (and not attached):
[1] cluster_1.11.13 tools_2.9.0



Patrick



More information about the R-devel mailing list