S

Taking a closer look at cblas_zgemm
void cblas_zgemm (
const CBLAS_LAYOUT Layout, const CBLAS_TRANSPOSE transa, const CBLAS_TRANSPOSE transb, const MKL_INT m, const MKL_INT n, const MKL_INT k,
const void *alpha, const void *a, const MKL_INT lda, const void *b, const MKL_INT ldb,
const void *beta, void *c, const MKL_INT ldc);
shows that the arguments alpha and beta must passed by reference. So the DllImport must look like that:
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, SetLastError = false)]
internal static extern void cblas_zgemm(
int Order, int TransA, int TransB, int M, int N, int K,
ref ComplexDouble alpha, [In] ComplexDouble[,] A, int lda, [In] ComplexDouble[,] B, int ldb,
ref ComplexDouble beta, [In, Out] ComplexDouble[,] C, int ldc);
I somehow missed that because for cblas_dgemm
void cblas_dgemm (
const CBLAS_LAYOUT Layout, const CBLAS_TRANSPOSE transa, const CBLAS_TRANSPOSE transb, const MKL_INT m, const MKL_INT n, const MKL_INT k,
const double alpha, const double *a, const MKL_INT lda, const double *b, const MKL_INT ldb,
const double beta, double *c, const MKL_INT ldc);
the arguments alpha and beta are passed by value.
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, SetLastError = false)]
internal static extern void cblas_dgemm(
int Order, int TransA, int TransB, int M, int N, int K,
double alpha, [In] double[,] A, int lda, [In] double[,] B, int ldb,
double beta, [In, Out] double[,] C, int ldc);
Like that cblas_zgemm works on Windows and on Linux. I still don't understand why it was working on Windows with the ref?