[R] Calling Lapack From C code

Stephane DRAY stephane.dray at umontreal.ca
Thu Aug 12 01:20:37 CEST 2004

Hello List,
I have create a small package with C code. In the C code, I call Fortran 
routines of Lapack. Here is the call in the C function:

F77_CALL(dgesvd)(&jobu, &jobvt,&size, &size,A, &size, 
D,U,&size,V,&size,&work1, &lwork,&error);

In the src directory, I have a Makevars File with:

And in the beginning of C code,  I include the following lines
#include <stddef.h>
#include <math.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <Rmath.h>
#include <R.h>
#include <R_ext/Utils.h>
#include "adesub.h"

I have compiled the Package on my PC under windows XP (Rcmd install works 
I have try to install it on another computer with R-1.9.1 running under MAC 
OS X (Panther 10.3.4), but the installation failed with the following message:

FORWARD.C:328: error: `dgesvd_' undeclared (first use this function)
FORWARD.C:328: error: (Each undeclared identifier is reported only once for
    each function it appears in.)
make: *** [FORWARD.o] Error 1
ERROR: compilation failed for package 'Packfor2'
** Removing 

I have no idea why this installation does not work.

Any advice would be very appreciate.

Thanks in advance,


Stéphane DRAY

Département des Sciences Biologiques
Université de Montréal, C.P. 6128, succursale centre-ville
Montréal, Québec H3C 3J7, Canada

Tel : (514) 343-6111 poste 1233         Fax : (514) 343-2293
E-mail : stephane.dray at umontreal.ca

Web                                          http://www.steph280.freesurf.fr/

More information about the R-help mailing list