From lxh37 at psu.edu  Sun Aug 26 14:50:13 2012
From: lxh37 at psu.edu (LIYING HUANG)
Date: Sun, 26 Aug 2012 08:50:13 -0400 (EDT)
Subject: [Rd] include dll in R-package
In-Reply-To: <CABDUZc8DiJssR-B+7pHvb9AMrZMjr_zG+Bi1244jXRFrS_t2wA@mail.gmail.com>
Message-ID: <543907278.1925447.1345985413153.JavaMail.root@psu.edu>


Jeff,

Thanks for the reply.

For "explicit dependency", can dll and functions be specified 
in namespace and imported by the package automatically? or
the user has to use dyn.load and is.loaded to load the dll
and functions in R? If it is the former, could you point
me to an example that I could learn? Thanks!

Liying

----- ???? -----
???: "Jeff Ryan" <jeff.a.ryan at gmail.com>
???: "Kasper Daniel Hansen" <kasperdanielhansen at gmail.com>
??: r-devel at r-project.org, "Dirk Eddelbuettel" <edd at debian.org>
????: ???, 2012? 8 ? 24? ?? 10:28:50
??: Re: [Rd] include dll in R-package

Any package can link to external DLLs.  You'll need to make that an
explicit dependency, have some configure script and distribute the
library somewhere else, but many packages on CRAN already do this.

My RBerkeley uses a user installed Oracle Berkeley DB that is linked
to at configure time, of course there are many other examples as well.

And distributing _off_ CRAN is of course a reasonable alternative.

HTH
Jeff

On Fri, Aug 24, 2012 at 9:21 AM, Kasper Daniel Hansen
<kasperdanielhansen at gmail.com> wrote:
> On Fri, Aug 24, 2012 at 10:16 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
>>
>> On 24 August 2012 at 09:06, LIYING HUANG wrote:
>> | We have several projects in the center done by researchers over years
>> | in Fortran, there are copy right issues etc to prevent us from
>>                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> | giving away the source codes, but a lot of social scientist are
>>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> | interested to use the program. We tried to use dlls to make plugins
>> | (available in our website) in various statistics platforms
>> | (SAS, STATA and R) to make it available to general public.
>> |
>> | We used to be able to build R package using dll on version R-2.7.0,
>> | , but failed to build with newer R version with the same source.
>> | Any help is greatly appreciated.
>> |
>> | When I try to build R package for newer version of R, I could build
>> | to get "lcca_1.0.0.tar.gz", but when I "R CMD check lcca_1.0.0.tar.gz",
>> | I got error message as:
>> |
>> | * using log directory 'D:/project/LCCA/lcca.Rcheck'
>> | * using R version 2.15.1 (2012-06-22)
>> | * using platform: i386-pc-mingw32 (32-bit)
>> | * using session charset: ISO8859-1
>> | * checking for file 'lcca/DESCRIPTION' ... OK
>> | * checking extension type ... Package
>> | * this is package 'lcca' version '1.0.0'
>> | * checking package namespace information ... OK
>> | * checking package dependencies ... OK
>> | * checking if this is a source package ... OK
>> | * checking if there is a namespace ... OK
>> | * checking for executable files ... WARNING
>> | Found the following executable file(s):
>> |   libs/lcca.dll
>> | Source packages should not contain undeclared executable files.
>> | See section 'Package structure' in the 'Writing R Extensions' manual.
>> | * checking whether package 'lcca' can be installed ... ERROR
>>
>> This tells you that in order to have a proper package, you need to include
>> the very source code you want to hide.
>>
>> This is a CRAN Policy decision enforced by current R versions (but not the
>> rather old version you compared against), and there is now way around it.
>> You could try to construct "defunct" packages lacking the DLLs and instruct
>> the users to get them from somewhere else, but that is at the same rather
>> error prone (as you will lack all the built-time checks you would have with
>> source code, as well as a better assurrance that compatible tools are used)
>> and distasteful as CRAN is about Open Source.
>>
>> So your best bet may be to go back to the copyright holders....
>>
>
> Dirk's comments are extremely relevant if you were hoping to host the
> package on CRAN (which you basically won't be allowed to).  You can still
> distribute it from your institutions homepage I think.
>
> Kasper
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Jeffrey Ryan
jeffrey.ryan at lemnica.com

www.lemnica.com

______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] include dll in R-package
LIYING HUANG