Commit 17cd4207 authored by Ross Girshick's avatar Ross Girshick
Browse files

Add extern C { ... } around blas code. This fixes compilation issues with...

Add extern C { ... } around blas code. This fixes compilation issues with MATLAB R2014a, which seems to use g++ by default to compile .c files.
parent 22f16050
......@@ -8,6 +8,10 @@
#ifndef BLAS_INCLUDE
#define BLAS_INCLUDE
#ifdef __cplusplus
extern "C" {
#endif
/* Data types specific to BLAS implementation */
typedef struct { float r, i; } fcomplex;
typedef struct { double r, i; } dcomplex;
......@@ -22,4 +26,8 @@ typedef int blasbool;
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#define MAX(a,b) ((a) >= (b) ? (a) : (b))
#ifdef __cplusplus
}
#endif
#endif
......@@ -3,6 +3,10 @@
/* Functions listed in alphabetical order */
#ifdef __cplusplus
extern "C" {
#endif
#ifdef F2C_COMPAT
void cdotc_(fcomplex *dotval, int *n, fcomplex *cx, int *incx,
......@@ -428,3 +432,7 @@ int ztrsm_(char *side, char *uplo, char *transa, char *diag, int *m,
int ztrsv_(char *uplo, char *trans, char *diag, int *n, dcomplex *a,
int *lda, dcomplex *x, int *incx);
#ifdef __cplusplus
}
#endif
#include "blas.h"
#ifdef __cplusplus
extern "C" {
#endif
int daxpy_(int *n, double *sa, double *sx, int *incx, double *sy,
int *incy)
{
......@@ -47,3 +51,7 @@ int daxpy_(int *n, double *sa, double *sx, int *incx, double *sy,
return 0;
} /* daxpy_ */
#ifdef __cplusplus
}
#endif
#include "blas.h"
#ifdef __cplusplus
extern "C" {
#endif
double ddot_(int *n, double *sx, int *incx, double *sy, int *incy)
{
long int i, m, nn, iincx, iincy;
......@@ -48,3 +52,7 @@ double ddot_(int *n, double *sx, int *incx, double *sy, int *incy)
return stemp;
} /* ddot_ */
#ifdef __cplusplus
}
#endif
#include <math.h> /* Needed for fabs() and sqrt() */
#include "blas.h"
#ifdef __cplusplus
extern "C" {
#endif
double dnrm2_(int *n, double *x, int *incx)
{
long int ix, nn, iincx;
......@@ -60,3 +64,7 @@ double dnrm2_(int *n, double *x, int *incx)
return norm;
} /* dnrm2_ */
#ifdef __cplusplus
}
#endif
#include "blas.h"
#ifdef __cplusplus
extern "C" {
#endif
int dscal_(int *n, double *sa, double *sx, int *incx)
{
long int i, m, nincx, nn, iincx;
......@@ -42,3 +46,7 @@ int dscal_(int *n, double *sa, double *sx, int *incx)
return 0;
} /* dscal_ */
#ifdef __cplusplus
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment