Problem Linking VC++.NET with MKL

Problem Linking VC++.NET with MKL

Iam trying to use the LAPACK routines in my MS VC++.NET program.
Iam using Visual Studio .NET 2003.
Included files : mkl_cblas.h, mkl.h, mkl_lapack.h
Included libs : mkl_c.lib.

Many of the routines work fine. Problem is with routines that take the first argument as character.

Any suggestions ?

Many Thanks.,

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

First of all you should need to include only mkl.h as it includes all the other include files.

Can you create a small example showing the issue in which one routine is called that has a character in the parameter list? We will look at that and try to solve the issue. All of our LAPACK examples are Fortran.

On the other hand, can you call BLAS functions such as dgemm via the cblas interface? If you can then the issue is just how to handle the characters in your program.



Here is the example :

The appropriate headers are included. The first call to lapack routine dgetrf works just fine. The call to dgetrs doesnt work.

Also note that the same piece of code works fine with MS VC ++ 6.0, i.e. both functions dgetrf and dgetrs work fine.

After I copy it to MS VC++.NET (with managed extensions) it doesnt work anymore and crashes at the second function call.

Int32 CBLAS::Test()


double *a = new double[4];

a[0] = 4.0000063240007506;

a[1] = 6.0000000000099609;

a[2] = 10.000015811350039;

a[3] = 2.0000000000033205;

int m = 2, n = 2;

int lda = 2;

int *ipiv = new int[2];

int info;

DGETRF(&m,&n, a,&lda,ipiv,&info);

double *b = new double[2];

b[0] = 56.0;

b[1] = 13.0;

char trans = 'N';

int ldb = 2, nrhs = 1;

DGETRS(&trans, &n,&nrhs, a, &lda,ipiv, b, &ldb,&info);



Thanks for the example. We will take a look at this and try to find out what is the problem.


I have checked this example. Test work fine with any MKL versions.
Can you send whole projectto me ?

Thank you for the response.
The test works fine I know - it doesnt work when you create a class library in managed c++ and then call it from other programs.
Attached is the source project.

Thank you.

Thank you for all the responses. I found the solution its a compiler issue discussed in KB 814472.

Thank you.

I have investigate this problem. The problem in the libguide (OMP). The very simple solution is using mkl_c_dll.lib insteadof mkl_c.lib.

Leave a Comment

Please sign in to add a comment. Not a member? Join today