[R] Building a package with an existing dll

Simon Knapp sleepingwell at gmail.com
Tue Oct 16 07:27:30 CEST 2012

Anything you put in the folder 'inst' of a package gets copied, as is,
to the installed package once 'everything else' is done (see section
1.1.3 of "Writing R Extensions" - which you read for caveats). Hence
you can create


- <arch> is either 'x64' or 'i386' (or both if you can compile for
both architectures) for 64 or 32 bit R respectively, and
- <package_name> is the name of the package.

Then as per section 1.6.3 of "Writing R Extensions" You can then add the line


to your NAMESPACE file and it should then work as before (noting that
you should use the PACKAGE argument in your .C, .Call and .External
calls to the routines therein). Optionally, you can list the symbol
names in the call to useDynLib as per section 1.6.3 of "Writing R

On Tue, Oct 16, 2012 at 1:24 PM, GlennManion
<glenn.manion at environment.nsw.gov.au> wrote:
> I have setup a package directory structure with all the relevent files in the
> src, R, man and data directories.
> Also have the correct DESCRIPTION and NAMESPACE files in the root directory.
> I don't wisk to recompile the .dll file in the src directory as it currently
> works fine if I locate it in the same workdirectory as my R source code that
> calls it.
> This is a little tedious having to move source and dll into every directory
> that I wish to work in, thus the need to convert into a package.
> Is there a way to create a package that does not need the dll re-compiled?

More information about the R-help mailing list