Skip to content
Prev 37537 / 63424 Next

including DLL in a package

loosmart wrote:
Hi Martin,

I wrote a detailed example to a similar question on R-help.  It can be
viewed at:

http://r.789695.n4.nabble.com/Writing-own-simulation-function-in-C-td1580190.html#a1580423

The source code mentioned in the post can be obtained from:

http://gist.github.com/323498


The example was for C and not C++, but maybe it can help you get the package
building correctly.  Basically:

1) Write your C functions and put them in the /src directory of the package.

2) Write R wrappers for the C functions and put them in the /R directory
along with a zzz.R that includes a .First.Lib() which calls library.dynam().


With these requirements satisfied both R CMD INSTALL and R CMD build
--binary should be able to produce working packages.  Example files that
satisfy the points above are included in the source code I linked to.

Hope this helps!

-Charlie

-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University