@@ -30,14 +30,11 @@ char hasopenmp=0;
3030#define LIBCBLASNAME "/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib"
3131#endif
3232#elif defined(_WIN32 )
33- #if defined(_WIN64 )
34- #if defined(__aarch64__ )|| defined(_M_ARM64 )
35- #define LIBCBLASNAME "libopenblas_arm64.dll"
36- #else
3733#define LIBCBLASNAME "libopenblas.dll"
38- #endif
39- #else
40- #define LIBCBLASNAME "libopenblas_32.dll"
34+ #if defined(__aarch64__ )|| defined(_M_ARM64 )
35+ #define LIBCBLASNAME2 "libopenblas_arm64.dll"
36+ #elif !defined(_WIN64 )
37+ #define LIBCBLASNAME2 "libopenblas_32.dll"
4138#endif
4239#elif defined(ANDROID ) || defined(__OpenBSD__ )
4340#define LIBCBLASNAME "liblapack.so"
@@ -78,23 +75,32 @@ void cblasinit(C*libpath) {
7875#elif defined(__wasm__ )
7976 libcblas = 0 ;
8077#elif defined(_WIN32 )
81- fprintf ( stderr , "a1\n" );
78+ #if defined( __aarch64__ ) || defined( _M_ARM64 ) || !defined( _WIN64 )
8279 if (libpath && * libpath ){
83- fprintf (stderr , "a2 %s\n" ,libpath );
84- strcpy (cblasfile ,libpath );strcat (cblasfile ,"\\" );strcat (cblasfile ,LIBCBLASNAME );
85- fprintf (stderr , "a3 %s\n" ,cblasfile );
80+ strcpy (cblasfile ,libpath );strcat (cblasfile ,"\\" );strcat (cblasfile ,LIBCBLASNAME2 );
8681 if (!(libcblas = LoadLibraryA (cblasfile ))){ /* first try current directory */
87- strcpy (cblasfile ,libpath );strcat (cblasfile ,"\\..\\addons\\math\\lapack2\\lib\\" );strcat (cblasfile ,LIBCBLASNAME );
88- fprintf (stderr , "a4 %s\n" ,cblasfile );
82+ strcpy (cblasfile ,libpath );strcat (cblasfile ,"\\..\\addons\\math\\lapack2\\lib\\" );strcat (cblasfile ,LIBCBLASNAME2 );
8983 if (!(libcblas = LoadLibraryA (cblasfile ))) /* lapack2 addon lib folder */
90- fprintf (stderr , "a5\n" );
91- libcblas = LoadLibraryA (strcpy (cblasfile ,LIBCBLASNAME ));
84+ libcblas = LoadLibraryA (strcpy (cblasfile ,LIBCBLASNAME2 ));
9285 }
93- } else libcblas = LoadLibraryA (strcpy (cblasfile ,LIBCBLASNAME ));
86+ } else libcblas = LoadLibraryA (strcpy (cblasfile ,LIBCBLASNAME2 ));
9487 if (libcblas && !GetProcAddress (libcblas ,"cblas_dgemm" )){ /* check cblas routine */
95- fprintf (stderr , "a6\n" );
9688 FreeLibrary (libcblas ); libcblas = 0 ;
9789 }
90+ #endif
91+ if (!libcblas ){
92+ if (libpath && * libpath ){
93+ strcpy (cblasfile ,libpath );strcat (cblasfile ,"\\" );strcat (cblasfile ,LIBCBLASNAME );
94+ if (!(libcblas = LoadLibraryA (cblasfile ))){ /* first try current directory */
95+ strcpy (cblasfile ,libpath );strcat (cblasfile ,"\\..\\addons\\math\\lapack2\\lib\\" );strcat (cblasfile ,LIBCBLASNAME );
96+ if (!(libcblas = LoadLibraryA (cblasfile ))) /* lapack2 addon lib folder */
97+ libcblas = LoadLibraryA (strcpy (cblasfile ,LIBCBLASNAME ));
98+ }
99+ } else libcblas = LoadLibraryA (strcpy (cblasfile ,LIBCBLASNAME ));
100+ if (libcblas && !GetProcAddress (libcblas ,"cblas_dgemm" )){ /* check cblas routine */
101+ FreeLibrary (libcblas ); libcblas = 0 ;
102+ }
103+ }
98104#else
99105 if (libpath && * libpath ){
100106 int i = 0 ;
0 commit comments