Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

c# Marshalling LAPACKE_zgesvxx

Gianluca_G_1
Beginner
378 Views

 

I implemented a C# program that test LAPACKE_zgesvxx function. 


The example works with x64 platform but fail with x86 platform, return info=-7 error!

I suppose there are difference in function declaration, but I don't know where, and how to solve it.

I did many changes in the declaration part, but with 25 parameters became quite difficult to find the solution.

any ideas?

I Attach the example code and the data files used to test.

 


Thank you

Gianluca

0 Kudos
2 Replies
Dmitry_B_Intel
Employee
378 Views

Probably x86 does not correctly interprets 'long' type, which is 8-byte in C#. Did you try replacing 'long' with 'int'?


 

0 Kudos
Gianluca_G_1
Beginner
378 Views

Hi Dmitry,

 [DllImport("mkl_rt.dll", ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
        internal static extern int LAPACKE_zgesvxx(
            int matrix_layout,
            char fact,
            char trans,
            int n,
            int nrhs,
            [In, Out] Complex* A,
            int lda,
            [In, Out] Complex* af,
            int ldaf,
            [In, Out] int[] ipiv,
            ref char equed,
            [In, Out] double[] r,
            [In, Out] double[] c,
            [In, Out] Complex* B,
            int ldb,
            [In, Out] Complex* x,
            int ldx,
            ref double rcond,
            ref double rpvgrw,
            [In, Out] double[] berr,//ref double berr,
            int n_err_bnds,
            [In, Out] double[] err_bnds_norm,
            [In, Out] double[] err_bnds_comp,
            int nparams,
            [In, Out] double[] parameters
        );

 

I replaced long with int and now it works on both platforms 

 

Thank you

 BR

Gianluca

 

0 Kudos
Reply