Martin,

On Wed, Aug 25, 2010 at 10:17 AM, Loos, Martin <Martin.Loos@eawag.ch> wrote:

> Good afternoon!
>
> It may seem trivial to some/most of You, but I found it difficult to
> properly include a C++-based .dll into a package that I want to build for
> usage in R. I read through the "Writing R extensions..." & "R administration
> ..." instructions, but it seems I did not "grasp the bigger picture".
>
> The way I figured out to use the .dll in my package finally worked for
> using that package from the R console, but it gives multiple error and
> warning messages when running the RCMD check pkg command in the shell.
>
> What I did: I created the package skeleton via package.skeleton() including
> a function that makes both (1) a
> library.dynam() call to a .dll and (2) a .C() call including the name of
> the function in that DLL. Next, I run RCMD INSTALL pkg to install the
> package and then created a /lib folder in the installed package containing
> the .dll file.
>

As you say below, the way to go here is to add a /src folder in the package
skeleton which contains your C/C++ code and
header files and then run R CMD INSTALL, which will compile your code into a
.dll file and place it in the appropriate directory,
ie the /lib directory. It should not be necessary to do this manually.

hth, Ingmar

PS: It's hard to tell what is going wrong without the actual error messages.




> I tried alternatives, e.g., (a) containing a /src folder in may package
> skeleton with the .dll in it and/or (b) including zzz.R with a .First.lib
> function including the library call .... but nothing worked out when running
> the package check.
>
> help! thank You very much, MArtin
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

