[R] stepping into a .C call

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Apr 26 08:35:09 CEST 2004


On Mon, 26 Apr 2004 Toby.Patterson at csiro.au wrote:

> No - not from debug directly. You need to read "writing R extensions" in
> the help. 

You can step into the call with a C-level debugger like gdb (which Writing
R Extensions introduces in section `Finding entry points in dynamically
loaded code'), but only if the package was compiled (with debug options)  
on your machine and the sources are still installed.  However, it is
almost certainly easier to read the C source code, which is in the package
sources.

The distributed Windows binaries (and `Fred J.' quoted Windows in PR#6812)  
are not compiled with debug options, so to do this under Windows you need 
to start by compiling R and the package yourself.


> -----Original Message-----
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Fred J.
> Sent: Monday, April 26, 2004 7:45 AM
> 
> The Debug and mvbutils packages by Mark Bravington
> have been a great help for me in learning R, until I
> come to a line in the R code like ".C("fun name",...).
> Is there a way to step into this call and see what the
> source code does exactly to the supplied arrgs? 
> One example in the "fdim" package, a line like 
> DK <- .C("pointdif", as.integer(NumRow),
> as.integer(NumCol), as.integer(X), NumpDif =
> as.integer(NumpDif))
> I would like to know what the code does inorder to
> come up with the value to assign to DK.

-- 
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-help mailing list