[Rd] How to use R and add-on packages as library in C/C++

Pai-Hsien Hung pshung at mail2000.com.tw
Mon Aug 21 06:28:16 CEST 2006



Thanks for your reply.  

  I have already read the manual again, and use the R.dll (Ch 8.2.2) (Am I
right?).  Running the example in the section is OK.  But, when I try to add
"do_matprod" function in the same example, I don't know what args should put
in.  The function description in array.c is SEXP attribute_hidden
do_matprod( SEXP call, SEXP op, SEXP args, SEXP rho), and where I can get
the definition and description of each variables, call, op, args, ....

Thanks,

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: Friday, August 18, 2006 10:32 PM
To: Pai-Hsien Hung
Cc: r-devel
Subject: Re: [Rd] How to use R and add-on packages as library in C/C++

This is indeed in the manual you mention.  To use R functions and not just 
standalone libRmath, you need to embed R.

On Fri, 18 Aug 2006, Pai-Hsien Hung wrote:

> Hi,
>   I have a question for building a standalone exe file via C/C++ with R 
>   and add-on packages in Windows (Compiler is VC).  It may looks like 
>   ...
> 
> #include <R.h>
> #include <Rmath.h>
> 
> int main() {
>   double *x, *y, z;
> 
>   // ... (Variables initial)
> 
>   z = ar( x, ...); 
>   // In this example, I want use the ar (time series) function (in stats
package) 
>   // as a library funciton.
> 
>   // ... (Other statement)
> 
>   return 0;
> }
> 
>   In the "Writing R Extensions" manual, just demo with numerical 
>   functions, not statistical functions.  I don't know is it possible to 
>   use statistical functions (Time series at least) or other functions in 
>   the add-on package, and how to make it.  Thanks for your patient to 
>   reading this. ^^
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list