Hello,

First of all I'm not sure what all of this buys us, so I'd be somehow reluctant to change something that works without understanding what we gain and what we lose.

Why is this important/relevant for you. You say "there are situations where it is useful to link directly to Rcpp.dll". Please describe.

Also, the dll is built anyway, so your client package is free to link against it, i.e. we provide Rcpp:::LdFlags for convenience but if other packages want to use something else, that's ok too. Why can't you just alter you configure/Makevars so that they link against the dll ?

Also, does

#if defined(mingw32) || defined(WIN32)

take care of windows 64 ?

For the RcppExportFinal thing, I just don't have opinions about it.

Romain

Le 10/07/10 03:25, Dominick Samperi a écrit :
Here are some suggested changes (under Windows) that will not affect
existing users but may help to prevent clashes with other packages in
the future.

1. RcppExport is not defined the way it used to be under Windows, but
there are situations where the old definition is convenient. For example,
it reduces the size of package DLL's the are not intended to be used
by other packages (the most common situation).

A simple work-around is to define RcppExportFinal the old way, using
something like:

#if defined(mingw32) || defined(WIN32)
#define RcppExportFinal extern "C" __declspec(dllexport)
#else
#define RcppExportFinal extern "C"
#endif

Let me know if/when you implement this so it does not clash with
the same definition in my package.

2. The current default behavior where a static lib is used
(libRcpp.a) is probably the most convenient and portable, but
there are situations where it is useful to link directly to Rcpp.dll.

To facilitate this one of the path functions in RcppLdpath.R
needs to be changed slightly for the case static=FALSE:

RcppLdFlags <- function(static=staticLinking()) {
     rcppdir <- RcppLdPath()
     if (static) {                               # static is default on
Windows and OS X
         flags <- paste(rcppdir, "/libRcpp.a", sep="")
         #if (.Platform$OS.type=="windows") {
         #    flags <- shQuote(flags)
         #}
     } else {                    # else for dynamic linking
         flags <- paste("-L", rcppdir, " -lRcpp", sep="") # baseline setting
         if((.Platform$OS.type == "windows")) {
           flags <- paste(rcppdir, "s/Rcpp.dll",sep="")
         }
         if ((.Platform$OS.type == "unix") &&    # on Linux, we can use
rpath to encode path
             (length(grep("^linux",R.version$os)))) {
             flags <- paste(flags, " -Wl,-rpath,", rcppdir, sep="")
         }
     }
     invisible(flags)
}

Dominick

--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/a5CK2h : Les estivales 2010
|- http://bit.ly/aJHNLV : Rmetrics slides
`- http://bit.ly/98Uf7u : Rcpp 0.8.1

_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to