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

cblas_daxpy fails in MKL 2025.2 when called from C++/CLI code that targets .NET Core.

Jones__Andrew
Beginner
1,623 Views

cblas_daxpy fails (crashes) when called from C++/CLI code that targets .NET Core (as well as related runtimes such as .NET 5 and .NET 8). It succeeds when called from native C++ or .NET Framework 4.8 code.

C++/CLI test code:

cli::array<double>^ x = gcnew cli::array<double>(3);
x[0] = -1.0; x[1] = 2.0; x[2] = -1.5;
cli::array<double>^ y = gcnew cli::array<double>(3);
y[0] = 2.5; y[1] = -3.0; y[2] = 4.0;
pin_ptr<double> px = &x[0];
pin_ptr<double> py = &y[0];
cblas_daxpy(3, 2.0, px, 1, py, 1);
Console::WriteLine("{0}\t{1}\t{2}", y[0], y[1], y[2]);

The attached Zip file contains the following projects:

  • TestDAXPYNativeCPP - native C++ console application
  • TestDAXPYNetFxCPP - C++/CLI console application targeting .NET Framework 4.8
  • TestDAXPYNetCoreCPPDLL - C++/CLI DLL targeting .NET 5
  • TestDAXPYNetCoreCS - C# console application that calls TestDAXPYNetCoreCPPDLL (C++/CLI .NET Core applications are not supported)

The bug is reproducible using both Visual Studio 2019 and Visual Studio 2022 compilers, and did not appear with versions 2025.1 and earlier of the Math Kernel Library.

0 Kudos
0 Replies
Reply