[R] getAttrib() and setAttrib()

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Jul 12 12:45:04 CEST 2000


On Wed, 12 Jul 2000, Richards, Tom wrote:

> Hello:
>  
> I am looking at "Writing R Extensions", subsection 3.6.4, using R 1.1.0,
> under NT4.0, with VC++ 6.0.  Under these conditions I can use the first
> method given for coding the out() function, but not the second, which uses
> getAttrib() and setAttrib().  I hope that someone will tell me how this
> second method can also be made to work.  Details follow, for anyone kind
> enough to help.  I include the actual code lifted from the manual, so that
> you can compile, dyn.load() and tell me that it works fine for you!

Your problem is specific to the compiler/OS you are using.  The standard
R for Windows system using mingw32 gcc has a workaround that you need
to work out how to apply to your system.

[...]

R_DimSymbol and R_DimNamesSymbol are exported variables in R.dll. Using
gcc, we include globalvar.h to map them correctly to imported symbols. You
will have to do something similar using VC++6.0.  I've forgotten exactly
what, and I am sure you can read the manual as well as I can.  (Looking
at front-ends/rtest.c suggests that 

__declspec(dllimport) SEXP R_DimSymbol;
__declspec(dllimport) SEXP R_DimNamesSymbol; 

are needed, so you will probably need to include a modified Rinternals.h.)

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list