From john.archie.mckown at gmail.com  Wed Mar 25 18:51:08 2015
From: john.archie.mckown at gmail.com (John McKown)
Date: Wed, 25 Mar 2015 12:51:08 -0500
Subject: [Rd] F77_CALL/NAME problem
In-Reply-To: <1427276694207-4705076.post@n4.nabble.com>
References: <1427276694207-4705076.post@n4.nabble.com>
Message-ID: <CAAJSdjhCSrcroCos9xsJ0cheQQHeZATqv_HRZ9a2VJ+on0SBJQ@mail.gmail.com>

On Wed, Mar 25, 2015 at 4:44 AM, bstr <nicola.lunardon at hotmail.it> wrote:
> 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<stdio.h>
> #include<R.h>
> #include<Rmath.h>
> #include<math.h>
>
> void F77_NAME(DGESV)( int*, int*, double*, int*, int*, double*, int*, int*);
>
> void solve( int *p, double *A, double *Ainv)
> {
>         ...
>         F77_CALL(DGESV)(p, p, Ain, p, ipiv, Bin, p, &info);
> }

Try lower case.

void F77_NAME(dgesv)( int*, int*, double*, int*, int*, double*, int*, int*);

 void solve( int *p, double *A, double *Ainv)
 {
         ...
         F77_CALL(dgesv)(p, p, Ain, p, ipiv, Bin, p, &info);
 }

The lapack.so file has a name "dgesv_" in it, not DGESV_.

>
> In order to create the ".so" file to load in R I downloaded the dgesv.f file
> as well as the dependencies (dgetf2.f dgetrf.f dgetrs.f dlaswp.f). As I was
> used to I ran in a terminal
>
> R CMD COMPILE *.f
> R CMD SHLIB MY_C_FILE.c *.o
>
> to get the MY_C_FILE.so file. However, when I try to load it in a R session
> I get the following error message "undefined symbol: DGESV_". Similar errors
> are occurring with some other (old) C files that I was used to use a couple
> of years ago. In this connection I have to say that those file were working
> under an older linux version (I guess ubuntu 12.04 LTS rather than the
> current one which is 14.04 LTS).
>
> Best Regards,
>
> N. Lunardon

-- 
If you sent twitter messages while exploring, are you on a textpedition?

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown



[Rd] F77_CALL/NAME problem
John McKown