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

Call dfsNewTask1D from C#

Chris_S_1
Beginner
462 Views

Hey,

I'm trying to get the spline functionality to work in C#. I don't seem to know what to put in place for the DFTaskPtr. I can see it's a void pointer in the mkl_df_types.h file, but I don't know how to translate that to C#.

I naively did the following:

    [SuppressUnmanagedCodeSecurity]
    internal sealed class MklNative
    {
        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, SetLastError = false)]
        internal static extern int dfsNewTask1D(ref IntPtr task, int nx, double[] x, int xhint, int ny, double[] y, int yhint);
    }

Which doesn't work. Any help would be welcome.

0 Kudos
3 Replies
Gennady_F_Intel
Moderator
462 Views

there is no such example ready to show - you may look at this https://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program KB article and see some C#examples. 

0 Kudos
Chris_S_1
Beginner
462 Views

Those examples don't show what to do about the void pointer DFTaskPtr, which is the problem. I don't need a full example, just need to know the proper field to put in the place when making the extern call.

0 Kudos
Andrey_N_Intel
Employee
462 Views

Hi Chris,

I created a simple C# example which constructs linear spline using Data Fitting component of Intel MKL. Please, have a look and let me know, if it helps.

Andrey

0 Kudos
Reply