I am a newbie to LAPACK, so please forgive my ignorance on some topics.
I want to use LAPACK from C/C++ under Windows, using Visual Studio 2010, and I have consulted some material from internet, but also got some confuse. From my consult, there are some different ways to use LAPACK under Windows:
Method 1: direct invoke LAPACK routine frome C/C++ source code. Because LAPACK was writted by FORTRAN, and its native interface was in FORTRAN, so some modification on C/C++ is needed. For example, the dgesv should be:
void dgesv_(const int *N, const int *nrhs, double *A, const int *lda, int
*ipiv, double *b, const int *ldb, int *info);
http://www.cs.rochester.edu/~bh/cs400/using_lapack.html, it said under Linux, the C/C++ source code should be linked with lapack, blas, F77 and I77. However, under Windows, there is no F77 and I77, how can above method be successful?
Method 2: using CLAPACK (f2c'ed version of LAPACK). As I understanding, the statement "f2c'ed version of LAPACK" means converting all LAPACK FORTRAN source code to C source code by f2c utility. In "clapack.h" header file, the FORTRAN subroutine dgesv prototype is:
int dgesv_(integer *n, integer *nrhs, doublereal *a, integer
*lda, integer *ipiv, doublereal *b, integer *ldb, integer *info);
In file "dgesv.c", there is a statement: "dgesv.f -- translated by f2c (version 20061008). You must link the resulting
object file with libf2c: on Microsoft Windows system, link with libf2c.lib...".
My question is: why we need to link the resulting object file with libf2c? I think the FORTRAN source code have been translated into C source code, and data type conversion is dealed with "f2c.h". (My guess is original LAPACK FORTRAN code has invoked some FORTRAN standard library code like cosine, after converted to C, these code should be dealed with C, so the libf2c comes in)
Method 3: I just found that LAPACK has a C INTERFACE in the lapacke directory, but I do not know can this interface be used under Windows? And if it can be used, how?
My last question: which method is the recommended way to use LAPACK under Windows?