From josh.m.ulrich at gmail.com  Fri Aug 14 04:33:09 2009
From: josh.m.ulrich at gmail.com (Joshua Ulrich)
Date: Thu, 13 Aug 2009 21:33:09 -0500
Subject: [Rd] Embed R, and provide a function to user scripts
In-Reply-To: <1e7471d50908131901k3d14f07ej6086b99820af5386@mail.gmail.com>
References: <1e7471d50908131807w118ce5b9ob0ead3503c9ca4e@mail.gmail.com> 
	<1e7471d50908131901k3d14f07ej6086b99820af5386@mail.gmail.com>
Message-ID: <8cca69990908131933g5b32e0b2v38a65342f4c37d4a@mail.gmail.com>

Hi Saptarshi,

See ?SHLIB and ?dyn.load.

HTH,
Josh
--
http://www.fosstrading.com



On Thu, Aug 13, 2009 at 9:01 PM, Saptarshi Guha<saptarshi.guha at gmail.com> wrote:
> Essentially I'd like to load the C function into ?the load table
> After that, I can create an R function
> rboo=function(x) .Call("boo",x)
>
> then user script cann call rboo
>
> Hope that clarifies things.
> Thanks in advance
>
> Saptarshi Guha
>
>
> On Thu, Aug 13, 2009 at 9:07 PM, Saptarshi Guha <saptarshi.guha at gmail.com>wrote:
>
>> Hello,
>> I'm not sure how to go about this. Suppose I have a function
>>
>> SEXP boo(SEXP x){
>> //do something
>> }
>>
>> Also, I have an executable which embeds R in itself. I would like to
>> provide a R function to user code to call that calls 'boo' e.g
>>
>> ##user supplied expression that is given to me
>>
>> x<-1
>> boo(x)
>>
>> One way is to create a library with function boo that performs .Call to
>> boo, but is there a way that I can do something like
>>
>> ainstall("rboo", boo)
>>
>> and calls to rboo in the language will be sent to 'boo' ?
>>
>> Thank you
>> Saptarshi
>>
>>
>>
>> Saptarshi Guha
>>
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Embed R, and provide a function to user scripts
Joshua Ulrich