Pergunta

I have an R script which was developed in Windows, and which requires a particular DLL to be in the path because it uses some functions contained therein (via the dyn.load function).

Is it possible to make the script work under Linux? Perhaps using wine?

Foi útil?

Solução

Assuming you have the source code of the non R code, I think your best bet will be to compile the code under Linux, e.g. Using a gcc compiler, create the shared library (.so file) and load it into R. If you put your code (R code and the other source code) in an R package you could integrate the R code and other source code so that they can be installed in one go, where the source is compiled on the fly.


The fact that you don't have the source code makes things quite a bit more complex. This SO post:

Using Windows DLL from Linux

Suggests to me that what you want is not trivial. One option would be to run the dll in a windows virtual machine. You then communicate using e.g. Tcp/ip to the dll running on your machine. So depending on how far you are willing to go, this might be a solution. The answers to the post above also suggest wine will not provide a satisfactory solution, but the post is quite old so wine might be improved in the meantime.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top