[R] R CMD SHLIB changes function name when compiling

Steve Pederson stephen.pederson at adelaide.edu.au
Fri Oct 8 10:43:04 CEST 2010


Hi,

I'm trying to write a function in C for implementation with .Call. When 
compiling using R CMD SHLIB characters seem to be added to the function 
name.

Here's the complete C code from the file summariseMCMC.c:

#include<R.h>
#include<Rdefines.h>
#include<Rinternals.h>

void summariseMCMC(SEXP data) {

     PROTECT(data=AS_NUMERIC(data));
     UNPROTECT(1);

}

Then after compiling  (R CMD SHLIB summariseMCMC.c) & loading the .dll

dyn.load("C:/R/R-2.11.1/bin/summariseMCMC.dll")
is.loaded("_Z13summariseMCMCP7SEXPREC")
[1] TRUE
is.loaded("summariseMCMC")
[1] FALSE

Just wondering if anyone had any pointers for getting rid of this, or 
have I missed something outrageously obvious?

Thanks,

Steve


sessionInfo()
R version 2.11.1 (2010-05-31)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
  [1] limma_3.4.4            Biobase_2.8.0          aroma.affymetrix_1.7.0
  [4] aroma.apd_0.1.7        affxparser_1.20.0      R.huge_0.2.0
  [7] aroma.core_1.7.0       aroma.light_1.16.0     matrixStats_0.2.1
[10] R.rsp_0.3.6            R.cache_0.3.0          R.filesets_0.8.3
[13] digest_0.4.2           R.utils_1.4.4          R.oo_1.7.3
[16] R.methodsS3_1.2.0

loaded via a namespace (and not attached):
[1] tools_2.11.1



More information about the R-help mailing list