From: Yu-Chin Date: Wed, 15 Oct 2014 15:17:41 +0000 (+0800) Subject: 1. use "extern C" in blas to make sure the compiled function names are always not... X-Git-Tag: v195~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=296992296eeb46cb6baa1717c200d64f4b8c7358;p=liblinear 1. use "extern C" in blas to make sure the compiled function names are always not mangled. 2. replace ``#'' with ``='' in matlab/Makefile --- diff --git a/blas/blasp.h b/blas/blasp.h index 745836d..fbf6e7f 100644 --- a/blas/blasp.h +++ b/blas/blasp.h @@ -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 diff --git a/blas/daxpy.c b/blas/daxpy.c index 58f345a..f762bd5 100644 --- a/blas/daxpy.c +++ b/blas/daxpy.c @@ -1,5 +1,9 @@ #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 diff --git a/blas/ddot.c b/blas/ddot.c index a64a280..adc0965 100644 --- a/blas/ddot.c +++ b/blas/ddot.c @@ -1,5 +1,9 @@ #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 diff --git a/blas/dnrm2.c b/blas/dnrm2.c index e50cdf7..7898783 100644 --- a/blas/dnrm2.c +++ b/blas/dnrm2.c @@ -1,6 +1,10 @@ #include /* 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 diff --git a/blas/dscal.c b/blas/dscal.c index a0eca0c..2bbdebc 100644 --- a/blas/dscal.c +++ b/blas/dscal.c @@ -1,5 +1,9 @@ #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 diff --git a/matlab/Makefile b/matlab/Makefile index c70a76f..a2c0284 100644 --- a/matlab/Makefile +++ b/matlab/Makefile @@ -7,7 +7,7 @@ CC ?= gcc CFLAGS = -Wall -Wconversion -O3 -fPIC -I$(MATLABDIR)/extern/include -I.. MEX = $(MATLABDIR)/bin/mex -MEX_OPTION = CC\#$(CXX) CXX\#$(CXX) CFLAGS\#"$(CFLAGS)" CXXFLAGS\#"$(CFLAGS)" +MEX_OPTION = CC="$(CXX)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" # comment the following line if you use MATLAB on a 32-bit computer MEX_OPTION += -largeArrayDims MEX_EXT = $(shell $(MATLABDIR)/bin/mexext)