[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:
PKG_LIBS =  $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

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 
fine).
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 
'/Library/Frameworks/R.framework/Versions/1.9.1/Resources/library/Packfor2'

I have no idea why this installation does not work.

Any advice would be very appreciate.

Thanks in advance,

Sincerely.


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