Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Linking Fortran Libs with VC++.NET

erincatto
Beginner
1,641 Views
I'm trying to link and run some simple code with BLAS and LAPACK libraries built with CVF 6.5. It links fine in VC++.NET, but I get a "runtime error" message before I reach main().

The same code runs fine with VC++6.0.

Does anyone know what's wrong?

Thanks,
Erin

===========
extern "C" void __stdcall
DAXPY(int *n, double* a, double* x, int* incx, double* y, int* incy);

extern "C" void __stdcall
DGETRF(int* m, int* n, double* A, int* lda, int* ipiv, int* info);

int
main()
{
double a, *x, *y;
int n, inc;

inc = 1;
n = 3;
a = 2.0;

x = new double;
y = new double;

x[0] = 2.0; x[1] = -1.0; x[2] = 1.0;
y[0] = 5.0; y[1] = 2.0; y[2] = -3.0;

DAXPY(&n, &a, x, &inc, y, &inc);

double *A = new double[n*n];

A[0] = 1.0; A[3] = 5.0; A[6] = -2.0;
A[1] = -1.0; A[4] = 9.0; A[7] = 3.0;
A[2] = -7.0; A[5] = 2.0; A[8] = 10.0;

int *ipiv = new int[3];
int info = 0;

DGETRF(&n, &n, A, &n, ipiv, &info);

delete [] x;
delete [] y;
delete [] A;
delete [] ipiv;

return 0;
}
0 Kudos
4 Replies
Steven_L_Intel1
Employee
1,641 Views
Where do your BLAS and LAPACK routines come from?

Steve
0 Kudos
erincatto
Beginner
1,641 Views
Its actually linking with LAPACK that causes problems. Linking with BLAS alone works. The LAPACK library was built in CVF 6.5 from LAPACK 3.0 Fotran files from www.netlib.org.

Right now I'm going to experiment with breaking the library up into smaller pieces.
0 Kudos
erincatto
Beginner
1,641 Views
I've reduced the problem to a small size. I downloaded only the files I need for DGETRF.F from netlib. I put together a .NET project and a CVF 6.5 project. These files are attached. The only settings to change is the location of the Fortran libs in the .NET project.

This still produces the same runtime error before main() is reached.

Erin
0 Kudos
Steven_L_Intel1
Employee
1,641 Views
Erin,

I tried your example using CVF 6.6A and VC.NET. It worked fine. No run-time errors.

Steve
0 Kudos
Reply