Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Error from using  dgecon of LAPACK and BLAS in R2009a
Date: Wed, 5 Aug 2009 10:25:03 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 39
Message-ID: <h5bmlv$pb7$1@fred.mathworks.com>
References: <h5bb4h$ee8$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1249467903 25959 172.30.248.38 (5 Aug 2009 10:25:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 5 Aug 2009 10:25:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:560949


"Renwen Lin" <linrenwen@gmail.com> wrote in message <h5bb4h$ee8$1@fred.mathworks.com>...
> I try to write down a mex file using and , in Matlab R2009a. 
> But get error LNK2019.
> I have tried such codes in R2008b, there no such errors.
> I am looking forward your help. 
> 
> -----------------------My code---------------------------
> #include "mex.h"
> #include "matrix.h"
> #include <stdlib.h>
> #include "blas.h"
> #include <math.h>
> #include <string.h>
> 
> void dgetrf(const int *M, const int *N, double A[], const int *LDA, 
> 		      int IPIV[], int *INFO);
> void dgecon(const char *NORM, const int *N, const double A[],
> 		      const int *LDA, const double *ANORM, double *RCOND, double WORK[], 
> 		      int IWORK[], int *INFO);
> void mexFunction(int nlhs, mxArray *plhs[],  int nrhs, const mxArray *prhs[])
> {
>    .. code that call dgetrf and dgecon
> }
> 
> -----------------------My command in Matlab -----------------
> mex ndbackslash.cpp "D:\Program Files\MATLAB\R2009a\extern\lib\win64\microsoft\libmwlapack.lib" "D:\Program Files\MATLAB\R2009a\extern\lib\win64\microsoft\libmwblas.lib"
> 
> -----------------------Debug errors -----------------
> C:\USERS\ALIN\APPDATA\LOCAL\TEMP\MEX_O9~1\ndbackslash.obj D:\PROGRA~2\MATLAB\R2009A\EXTERN\LIB\WIN64\MICROS~1\libmwlapack.lib D:\PROGRA~2\MATLAB\R2009A\EXTERN\LIB\WIN64\MICROS~1\libmwblas.lib  
>    Creating library C:\USERS\ALIN\APPDATA\LOCAL\TEMP\MEX_O9~1\templib.x and object C:\USERS\ALIN\APPDATA\LOCAL\TEMP\MEX_O9~1\templib.exp 
> ndbackslash.obj : error LNK2019: unresolved external symbol "void __cdecl dgecon(char const *,int const *,double const * const,int const *,double const *,double *,double * const,int * const,int *)" (?dgecon@@YAXPEBDPEBHQEBN1PEBNPEANQEANQEAHPEAH@Z) referenced in function "void __cdecl compute_lu(double *,int,int *,double *,int *,int)" (?compute_lu@@YAXPEANHPEAH01H@Z) 
> ndbackslash.obj : error LNK2019: unresolved external symbol "void __cdecl dgetrf(int const *,int const *,double * const,int const *,int * const,int *)" (?dgetrf@@YAXPEBH0QEAN0QEAHPEAH@Z) referenced in function "void __cdecl compute_lu(double *,int,int *,double *,int *,int)" (?compute_lu@@YAXPEANHPEAH01H@Z) 
> ndbackslash.mexw64 : fatal error LNK1120: 2 unresolved externals 
> 
> NB:  error LNK2019: unresolved external symbol "void __cdecl dgecon

You probably have to use stdcall convention.

Bruno