Where should I put pre-compiled DLLs?

I'm working on an package that will be used internally at my firm that will provide R bindings to a .NET interface for an internal software system. The .NET library is already compiled into a DLL and I'm unsure where this should live in my R package.

From Hadley's rpkg site it looks like the answer might be the inst directory, but I wanted to ask if anyone has done something similar and if there was any suggested best practice as to where I should put the DLL in my package?

Non-R Scripts in packages from Writing R Extensions suggests there isn't really any universal convention, but gives some common places other packages have used for non R code / DLLs. In general somewhere under inst/ is the correct spot I think.

1 Like

Thank you for your input Jim. The inst/ directory seems to work well.

A related question, which I'll pose here since anyone who cares about my initial post will also care about it -- I am having an issue with running R CMD check (devtools::check()). I get a warning about undeclared executable files. When I try to follow the advice from the Package Structure section of Writing R Extensions (below), it seems the file is being ignored.

they are listed (one filepath per line) in a file BinaryFiles at the top level of the package

I have tried using both windows line endings (\r\n) and Unix line endings (\n). Both seem to be ignored.

I'm guessing the primary issue here is that R CMD check doesn't know to read BinaryFiles file as I also see a note that it is a "Non-Standard file/directory found at the top level".

Any suggestions you, or anyone else, has would be greatly appreciated.

devtools::check() by default runs R CMD check with --as-cran, which unconditionally warns about binary files, as mentioned in the same Package Structure section.

Note that CRAN will not accept submissions containing binary files even if they are listed.

running devtools::check(cran = FALSE) with the executable path in BinaryFiles (including the inst/) does result in a clean check.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.