[Rd] inheriting C symbols
Jeff Ryan
jeff.a.ryan at gmail.com
Wed Aug 5 22:14:01 CEST 2009
Terry,
I think I don't quite follow what you want to do.
You have a package that needs to access the R level functions in
another, or the C level functions?
Do you need access *from R* for the above, or *from new C code*?
If you are just looking to call .Call("other_package", ...) I think
your only strategy is to list it as a dependency. Is there some
reason you don't want to do that?
Once it is a dependency you can simply call the C routines like they
are called within the package's R code.
Jeff
On Wed, Aug 5, 2009 at 2:24 PM, Terry Therneau<therneau at mayo.edu> wrote:
> Thanks for the information. I'd looked through the manual but missed
> this. Follow-up questions
>
> 1. I'd never paid much attention to that whole "register routines"
> section of the manual because a) it didn't seem necessary (my code
> worked anyway) and b) it's quite complex. Your answer is that if I dig
> into it, there is a way to export routines. Is there any other real
> advantage to registration?
>
> 2. The simpler method is to use a local=FALSE argument to dyn.load.
> Since it wasn't mentioned, I'll assume that there is no way to add text
> to the DESCRIPTION file saying "and load the symbols too"? It would be
> much simpler. Also a bit more dangerous of course, since function
> prototypes are not being exported via a header.
>
> Terry T
>
>
> On Wed, 2009-08-05 at 11:54 -0500, Jeff Ryan wrote:
>> This has been discussed before:
>>
>> http://www.nabble.com/Dynamic-linking-to-binary-code-from-other-packages---td20167535.html#a20474561
>>
>> Take a look at 'xts' on cran, or R-forge. Specifically:
>>
>> http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/inst/api_example/README?rev=386&root=xts&view=markup
>>
>> HTH
>> Jeff
>>
>> On Wed, Aug 5, 2009 at 11:29 AM, Terry Therneau<therneau at mayo.edu> wrote:
>> > The package coxme depends heavily on bdsmatrix, to the point of needing
>> > access to some of its C calls. The kinship package (in progress) uses
>> > the R level functions in bdsmatrix, but not the C calls. That is, I
>> > don't want to always export the symbols.
>> >
>> > For testing I can use an explicit dyn.load('somepath/bsdmatrix.so',
>> > local=F). How do I incorporate such a dependency in the DESCRIPTION
>> > file for coxme, so that it happens in general?
>> >
>> > Terry T.
>> >
>> > ______________________________________________
>> > R-devel at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-devel
>> >
>>
>>
>>
>
>
--
Jeffrey Ryan
jeffrey.ryan at insightalgo.com
ia: insight algorithmics
www.insightalgo.com
More information about the R-devel
mailing list