Question

I'm working on a program that uses the Accelerate framework (for LAPACK) and I have several issues. The code is written in C but needs to include C++ headers. I renamed the file to .cpp but it caused two errors, shown below.

C++ Error Image

So I then realized tried to #include <Accelerate/Accelerate.h> to include the headers, since what our LAPACK coder did was retype the definitions (dgemm_(), dposv_(), etc.) at the beginning of the file and rely on the compiler/linker to work things out. So I commented out those and just did the #include. What came out was this:

Accelerate Error Image

So, how do I use the LAPACK functions using Accelerate in a C++ file? I'm not that familiar with LAPACK, so I'm not sure how that framework normally works.

Was it helpful?

Solution

You should use call dgemm_ and dposv_ using the type __CLPK_integer or long instead of int. The error is because a long* cannot be implicitly converted to an int* in C++.

typedef long int    __CLPK_integer;
typedef long int    __CLPK_logical;
typedef float       __CLPK_real;
typedef double      __CLPK_doublereal;
typedef __CLPK_logical  (*__CLPK_L_fp)();
typedef long int    __CLPK_ftnlen;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top