[Rcpp-devel] [Summary] (Was: question re: LdFlags, RcppLdFlags

Dirk Eddelbuettel edd at debian.org
Thu Oct 10 17:36:37 CEST 2013


On 10 October 2013 at 17:15, Romain Francois wrote:
| They are quite useful for debugging too:
| 
| #if RCPP_DEBUG_LEVEL > 0
| #define RCPP_DEBUG( fmt, ... ) Rprintf( "%20s:%4d             " fmt "\n" 
| , short_file_name(__FILE__), __LINE__, ##__VA_ARGS__ ) ;
| #else
| #define RCPP_DEBUG( MSG, ... )
| #endif
| 
| So that we can write:
| 
| RCPP_DEBUG( "bla bla %d", 42 )
| 
| and leave it there when the code is not debugged.

Thanks for all the details and counts on macros. I was mostly aware of this
as you may recall that I wrote a few of those variants in Rcpp too, including
some of the DEBUG ones.

| > Can you (portably, with all (major) compilers and OS choices) pick out
| > symbols even when they have attribute_hidden set as R does all over its
| > sources?
| 
| No.
| 
| But since that sort of thing are typically the task of the package 
| maintainer: I don't care.

I don't follow at all. You appeared to be saying you had a solution to the
linking issue, I point out that hidden symbols are still hidden, and you say
it doesn't matter?  How so?
 
| read_symbols_from_object_file is just a convoluted way to call nm.
| 
|   tools:::read_symbols_from_object_file
| function (f)
| {
|      if (!nzchar(nm <- Sys.which("nm")))
|          return()
|      f <- file_path_as_absolute(f)
|      if (!(file.info(f)$size))
|          return()
|      s <- strsplit(system(sprintf("%s -Pg %s", shQuote(nm), shQuote(f)),
|          intern = TRUE), " +")
|      n <- length(s)
|      tab <- matrix("", nrow = n, ncol = 4L)
|      colnames(tab) <- c("name", "type", "value", "size")
|      i <- rep.int(seq_len(n), sapply(s, length))
|      j <- unlist(lapply(s, seq_along))
|      tab[n * (j - 1L) + i] <- unlist(s)
|      tab
| }

That is something different from the linking issue we were discussing. This
is a pretty printer for (non-stripped) object code using nm(1).
 
| But again, I don't care. Generating code is the task of the package 
| maintainer, so if I want to use something like that, it just has to work 
| on whatever I use.

I believe we were talking about two somewhat distinct issues here.  

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list