From ross at biostat.ucsf.edu  Wed Apr 18 06:17:22 2007
From: ross at biostat.ucsf.edu (Ross Boylan)
Date: Tue, 17 Apr 2007 21:17:22 -0700
Subject: [Rd] undefined symbol: Rf_rownamesgets
In-Reply-To: <46258B60.2080708@stats.uwo.ca>
References: <20070418024327.GA27800@wheat.betterworld.us>
	<46258B60.2080708@stats.uwo.ca>
Message-ID: <20070418041722.GJ13225@wheat.betterworld.us>

On Tue, Apr 17, 2007 at 11:07:12PM -0400, Duncan Murdoch wrote:
> On 4/17/2007 10:43 PM, Ross Boylan wrote:
> >I get the error
> > undefined symbol: Rf_rownamesgets
> >when I try to load my package, which include C++ code that calls that
> >function.  This is particularly strange since the code also calls
> >Rf_classgets, and it loaded OK with just that.
> >
> >Can anyone tell me what's going on?  
> >
> >For the record, I worked around this with the general purpose
> >attribute setting commands and R_RowNamesSymbol.  I discovered that
> >even with that I wasn't constructing a valid data.frame, and fell back
> >to returning a list of results.
> >
> >I notice Rinternals.h defines
> >LibExtern SEXP	R_RowNamesSymbol;   /* "row.names" */
> >twice in the same block of code.
> >
> >I'm using R 2.4.1 on Debian. The symbol seems to be there:
> >$ nm -D /usr/lib/R/lib/libR.so | grep classgets
> >00032e70 T Rf_classgets
> >$ nm -D /usr/lib/R/lib/libR.so | grep namesgets
> >00031370 T Rf_dimnamesgets
> >00034500 T Rf_namesgets
> 
> I don't see Rf_rownamesgets there, or in the R Externals manual among 
> the API entry points listed.  
You're right; sorry.  So does this function just not exist?  If so,
it would be good to remove the corresponding entries in Rinternals.h.

>Can't you use the documented dimnamesgets?
I did one better and didn't use anything!  I thought presence in
Rinternals.h constituted (terse) documentation, since the R Externals
manual says ("Handling R objects in C")
-------------------
   There are two approaches that can be taken to handling R objects from
within C code.  The first (historically) is to use the macros and
functions that have been used to implement the core parts of R through
`.Internal' calls.  A public subset of these is defined in the header
file `Rinternals.h' ...
-----------------------------

So is relying on Rinternals.h a bad idea?

In this case, accessing the row names through dimnamesgets looks a
little awkward, since it requires navigating to the right spot in
dimnames.  I would need Rf_dimnamesgets since I disabled the shortcut
names.

Ross



[Rd] undefined symbol: Rf_rownamesgets
Ross Boylan