Skip to content

[R-pkg-devel] Problem (with complex.h?) under Microsoft Windows

4 messages · Pierre Lafaye de Micheaux, Duncan Murdoch, Dirk Eddelbuettel

#
Dear all,

Thank you very much for your answers. And sorry for the last reply.
Here is how I solved my problem.

I incorporated some files from the src/ directory of the R package 
Faddeeva to
the subdirectory /libraries of the src/ directory of my own package.

This is because I needed to use some functions (in C)  from this package.
Then I used something as:
#include <R.h>
#include "Rmath.h"
#include "libraries/callFaddeeva.cpp"
#include "libraries/Faddeeva.cpp"
#include "libraries/RcppExports.cpp"

It is then possible, to initialise and manipulate complex numbers in C 
in my own code. For example:

cmplx I = C(0.0, 1.0); # For a + ib where a = 0 and b = 1.
cmplx res;
res = Faddeeva::erfi(I, 0.0);

And this compiles well under Windows now.

Note that I first tried to add the Faddeeva package in the Depends field 
of my own package thinking that this might prevent me from having to put 
the Faddeeva source files in my own package but it did not work ...

Best regards,

Pierre L.




Le 13/11/2015 21:36, Duncan Murdoch a ?crit :

  
    
#
On 02/01/2016 2:39 PM, Pierre Lafaye de Micheaux wrote:
I don't know of an R package called Faddeeva.  There's an 	RcppFaddeeva 
package.
You shouldn't need to copy the code if you're using RcppFaddeeva, but I 
can't tell you exactly what you need to do:  the Rcpp mailing list would 
be a better place to ask.
Depends is not the way to link at the C++ level.  If this is possible, 
you'll need to use LinkingTo as well as Imports.  I'm not sure if it's 
possible, but people on the Rcpp list would know...

Duncan Murdoch
#
Thank you for your comments.

It is indeed the RcppFaddeeva package. I had also tried to put 
RcppFaddeeva on the LinkingTo line with no success.
But I will try to ask on the Rcpp mailing list.

Best regards,
Pierre L.

Le 02/01/2016 21:09, Duncan Murdoch a ?crit :

  
    
#
On 3 January 2016 at 09:48, Pierre Lafaye de Micheaux wrote:
| Thank you for your comments.
| 
| It is indeed the RcppFaddeeva package. I had also tried to put 
| RcppFaddeeva on the LinkingTo line with no success.
| But I will try to ask on the Rcpp mailing list.

The RcppFaddeeva package does _not_ export any headers so there is little use
in adding a 'LinkingTo: RcppFadeeva'.

Compare the directory structure of the installed (or even source) RcppFadeeva
with, say, RcppArmadillo to see the difference.

In short, you can't just reuse / link / deploy another random package. It
needs to be exported.

But if you write to rcpp-devel (after subscribing first !!) we will try to
help you there.

Dirk