[Rd] Problem with shared library and lapack under windows

2015-06-03 Thread bstr
Hi all, I have a C function, say Cfun, that calls Lapack's DGEMM routine and I need to create a shared library to use Cfun inside R. The C file is the following #include #include #include void Cfun(double *res, double *X, int *n, int *q) { char *ptr_TRANSA, TRANSA='T', *ptr_TRANSB, TRAN

[Rd] Call R function in C in "optim fashion"

2015-04-16 Thread bstr
I am trying to extend an R package which is totally written in C. I have the following issue: in the C code I want to make a call to an R defined function as optim routine does. Nevertheless, when I try to trace down the main steps in optim, I am (more or less) able to follow the steps in the C sou

Re: [Rd] F77_CALL/NAME problem

2015-03-26 Thread bstr
Thank you John and William for the replies! @John: I downloaded the Fortran files from http://www.netlib.org/lapack/double/ (the link "dgesv.f plus dependencies"). In file dgesv.f the subroutine is declared as SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B,

[Rd] F77_CALL/NAME problem

2015-03-25 Thread bstr
Dear R-devel, I am trying to use Fortran DGESV subroutine into C. Here it is the relevant part of the C file I am currently writing #include #include #include #include void F77_NAME(DGESV)( int*, int*, double*, int*, int*, double*, int*, int*); void solve( int *p, double *A, double *Ainv) {

Re: [Rd] F77_CALL/NAME problem

2015-03-25 Thread bstr
I was not able to find why my old way to do things did not work. However, I "discovered" that dgesv is also in the header Lapack.h. So I just dropped form the C code the declarations F77_NAME/CALL and used directly function dgesv_ as declared in Lapack.h. Of course I had to compile with the -llapac